You are here

taxonomy_menu.module in Taxonomy menu 8.3

File

taxonomy_menu.module
View source
<?php

/**
 * @file
 * Contains taxonomy_menu.module.
 */
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_menu_help().
 */
function taxonomy_menu_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.taxonomy_menu':
      return t('<p>The Taxonomy Menu module transforms your taxonomy vocabularies into menus.</p>
       <p>See the <a href=":project_page">project page on Drupal.org</a> for more details.</p>', [
        ':project_page' => 'https://www.drupal.org/project/taxonomy_menu',
      ]);
  }
}

/**
 * Implements hook_entity_insert().
 *
 * Check for taxonomy term insert.
 */
function taxonomy_menu_taxonomy_term_insert(EntityInterface $entity) {
  \Drupal::service('taxonomy_menu.helper')
    ->generateTaxonomyMenuEntries($entity, FALSE);
}

/**
 * Implements hook_entity_delete().
 *
 * Check for taxonomy term deletion.
 */
function taxonomy_menu_taxonomy_term_delete(EntityInterface $entity) {
  \Drupal::service('taxonomy_menu.helper')
    ->removeTaxonomyMenuEntries($entity, FALSE);
}

/**
 * Implements hook_entity_update().
 *
 * Check for taxonomy term updates.
 */
function taxonomy_menu_taxonomy_term_update(EntityInterface $entity) {
  \Drupal::service('taxonomy_menu.helper')
    ->updateTaxonomyMenuEntries($entity, FALSE);
}