function _taxonomy_menu_nodeapi_helper in Taxonomy menu 8
Same name and namespace in other branches
- 6.2 taxonomy_menu.module \_taxonomy_menu_nodeapi_helper()
- 7.2 taxonomy_menu.module \_taxonomy_menu_nodeapi_helper()
- 7 taxonomy_menu.module \_taxonomy_menu_nodeapi_helper()
Abstraction of hook_node_<op>().
@TODO Rebuild the function.
Parameters
$node: The node to process.
$operation: A string of the operation to be performed [update|insert|delete].
File
- ./
taxonomy_menu.module, line 400 - Generates menu links for all selected taxonomy terms.
Code
function _taxonomy_menu_nodeapi_helper($node, $operation) {
$terms = array();
// Update the taxonomy menu for each terms
foreach ($terms as $key => $tid) {
$menu_name = taxonomy_menu_variable_get('vocab_menu', $term->vid, FALSE);
$sync = taxonomy_menu_variable_get('sync', $term->vid, TRUE);
$display_num = taxonomy_menu_variable_get('display_num', $term->vid, TRUE);
$hide_empty_terms = taxonomy_menu_variable_get('hide_empty_terms', $term->vid, FALSE);
$term = entity_load('taxonomy_term', $tid);
// taxonomy_term_load($tid) return FALSE if the term was not found
// if taxonomy $term is false, then go to the next $term
if (!$term) {
continue;
}
if ($term && $menu_name && $sync && ($display_num || $hide_empty)) {
switch ($operation) {
case 'insert':
break;
case 'update':
if ($hide_empty_terms) {
_taxonomy_menu_update_all_parents($term, $menu_name);
}
break;
case 'delete':
break;
}
}
// Report status.
//drupal_set_message($message, 'status');
// Rebuild the menu.
\Drupal::state()
->set('menu_rebuild_needed', TRUE);
}
}