hook_category_legacy($op, &$data, $edit = NULL, $legacy_map = NULL)
category/docs/developer/hooks/core.php, line 128
Respond to category import and export events.
Modules can hook in to the category import and export processes at various stages, and can affect how these processes occur.
$op What kind of action is being performed. Possible values:
$edit Optional. The form values submitted by the user. Hooks that implement the "_prepare" operations should copy the values from this array to somewhere more permanent, or they will get lost.
$legacy_map Optional. An array that maps old IDs to the IDs of their new imported equivalents. Particularly useful for hooks implementing the "import_taxonomy_submit" operation.
This varies depending on the operation.
| Name | Description |
|---|---|
| Hooks | Allow modules to interact with the Drupal core. |
<?php
function hook_category_legacy($op, &$data, $edit = NULL, $legacy_map = NULL) {
switch ($op) {
case 'import_taxonomy_form':
case 'import_book_form':
$form['category_foo'] = array(
'#type' => 'fieldset',
'#title' => t('Foo information'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['category_foo']['foo_bar'] = array(
'#type' => 'textfield',
'#title' => t('Bar text'),
'#description' => t('This text will be given to the bar field for all imported data.'),
);
return $form;
case 'import_taxonomy_prepare':
case 'import_book_prepare':
foreach ($data as $key => $item) {
$fields = array('foo_bar');
foreach ($fields as $field) {
$data[$key][$field] = $edit[$field];
}
}
break;
case 'import_taxonomy_submit':
case 'import_book_submit':
drupal_set_message(t('Appended foo information to new categories.'));
}
}
?>