function hook_checklistapi_checklist_info_alter in Checklist API 8
Same name and namespace in other branches
- 7 checklistapi.api.php \hook_checklistapi_checklist_info_alter()
Alter checklist definitions.
This hook is invoked by checklistapi_get_checklist_info(). The checklist definitions are passed in by reference. Additional checklists may be added, or existing checklists may be altered or removed.
Note: Checklist paths (#path) cannot be altered. See https://www.drupal.org/docs/8/api/routing-system/altering-existing-route... instead.
Parameters
array $definitions: The multidimensional array of checklist definitions returned by hook_checklistapi_checklist_info().
See also
hook_checklistapi_checklist_info()
checklistapiexample_checklistapi_checklist_info_alter()
1 function implements hook_checklistapi_checklist_info_alter()
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_alter in checklistapiexample/
checklistapiexample.module - Implements hook_checklistapi_checklist_info_alter().
1 invocation of hook_checklistapi_checklist_info_alter()
- checklistapi_get_checklist_info in ./
checklistapi.module - Gets checklist definitions.
File
- ./
checklistapi.api.php, line 148 - Hooks provided by the Checklist API module.
Code
function hook_checklistapi_checklist_info_alter(array &$definitions) {
// Add an item.
$definitions['example_checklist']['example_group']['new_item'] = [
'title' => t('New item'),
];
// Add a group.
$definitions['example_checklist']['new_group'] = [
'#title' => t('New group'),
];
// Move an item.
$definitions['example_checklist']['new_group']['example_item_1'] = $definitions['example_checklist']['example_group']['example_item_1'];
unset($definitions['example_checklist']['example_group']['example_item_1']);
// Remove an item.
unset($definitions['example_checklist']['example_group']['example_item_2']);
}