hook_category($op, $node = NULL)
category/docs/developer/hooks/core.php, line 43
Manipulate categories and containers, and respond to category-related events.
Hook_category() is designed to extend the functionality of hook_nodeapi() for category-specific situations. It allows other modules to define things such as extra attributes for categories, and extra general category settings.
$op What kind of action is being performed. Possible values:
This varies depending on the operation.
| Name | Description |
|---|---|
| Hooks | Allow modules to interact with the Drupal core. |
<?php
function hook_category($op, $node = NULL) {
switch ($op) {
case 'form':
$form['category_foo'] = array(
'#type' => 'fieldset',
'#title' => t('Foo information'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['category_foo']['category_foo_bar'] = array(
'#type' => 'textfield',
'#title' => t('Bar text'),
'#default_value' => $node->foo_bar,
'#description' => t('The bar text for foo.'),
);
return $form;
case 'settings':
$form['category_foo'] = array(
'#type' => 'fieldset',
'#title' => t('Foo settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['category_foo']['foo_bar'] = array(
'#type' => 'checkbox',
'#title' => t('Bar text for foo'),
'#default_value' => variable_get('category_foo_bar', 0),
'#description' => t('If checked, foo gets bar text.'),
);
return $form;
case 'view':
return theme('foo_bar', $node);
}
}
?>