You are here

function hook_checklistapi_checklist_info in Checklist API 8

Same name and namespace in other branches
  1. 7 checklistapi.api.php \hook_checklistapi_checklist_info()

Define all checklists provided by the module.

Any number of checklists can be defined in an implementation of this hook. Checklist API will register menu items and create permissions for each one.

For a working example, see checklistapiexample.module.

Return value

array An array of checklist definitions. Each definition is keyed by an arbitrary unique identifier. The corresponding multidimensional array describing the checklist may contain the following key-value pairs:

  • #title: The title of the checklist.
  • #path: The Drupal path where the checklist will be accessed.
  • #callback: A callback to provide the checklist items. See callback_checklistapi_checklist_items(). (This value is technically optional in order to provide backward compatibility for modules using the deprecated method of defining checklist items right in this array.)
  • #callback_arguments: (optional) An array of values to pass as arguments to the callback.
  • #description: (optional) A brief description of the checklist for its corresponding menu item.
  • #help: (optional) User help to be displayed in the "System help" block via hook_help().
  • #menu_name: (optional) The machine name of a menu to place the checklist into (e.g., "main-menu" or "navigation"). If this is omitted, Drupal will try to infer the correct menu placement from the specified path.
  • #storage: (optional) The storage backend for saving checklist progress. Allowed values are "config" and "state" for the Configuration and State systems respectively. Defaults to "config".
  • #weight: (optional) A floating point number used to sort the list of checklists before being output. Lower numbers appear before higher numbers.
  • (deprecated) Any number of arrays representing groups of items, to be presented as vertical tabs. Use #callback instead.

See also

callback_checklistapi_checklist_items()

hook_checklistapi_checklist_info_alter()

checklistapiexample_checklistapi_checklist_info()

1 function implements hook_checklistapi_checklist_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

checklistapiexample_checklistapi_checklist_info in checklistapiexample/checklistapiexample.module
Implements hook_checklistapi_checklist_info().
2 invocations of hook_checklistapi_checklist_info()
ChecklistapiRoutes::routes in src/Routing/ChecklistapiRoutes.php
Provides dynamic routes.
checklistapi_get_checklist_info in ./checklistapi.module
Gets checklist definitions.

File

./checklistapi.api.php, line 53
Hooks provided by the Checklist API module.

Code

function hook_checklistapi_checklist_info() {
  $definitions = [];
  $definitions['example_checklist'] = [
    '#title' => t('Example checklist'),
    '#path' => 'example-checklist',
    '#callback' => 'callback_checklistapi_checklist_items',
    '#callback_arguments' => [
      'Example value',
    ],
    '#description' => t('An example checklist.'),
    '#help' => t('<p>This is an example checklist.</p>'),
  ];
  return $definitions;
}