You are here

event_log_track_taxonomy.module in Events Log Track 8

Same filename and directory in other branches
  1. 8.2 event_log_track_taxonomy/event_log_track_taxonomy.module

Logs menu CUD commands in the event_log_track module.

File

event_log_track_taxonomy/event_log_track_taxonomy.module
View source
<?php

/**
 * @file
 * Logs menu CUD commands in the event_log_track module.
 */

/**
 * Implements hook_event_log_track_handlers().
 */
function event_log_track_taxonomy_event_log_track_handlers() {

  // Taxonomy event log handler.
  $handlers = array();
  $handlers['taxonomy'] = array(
    'title' => t('Taxonomy'),
  );
  return $handlers;
}

/**
 * Implements hook_taxonomy_vocabulary_insert().
 */
function event_log_track_taxonomy_taxonomy_vocabulary_insert($vocabulary) {
  $log = array(
    'type' => 'taxonomy',
    'operation' => 'vocabulary insert',
    'description' => t('%title (%name)', array(
      '%title' => $vocabulary
        ->get('name'),
      '%name' => $vocabulary
        ->get('vid'),
    )),
    'ref_char' => $vocabulary
      ->get('vid'),
  );
  event_log_track_insert($log);
}

/**
 * Implements hook_taxonomy_vocabulary_update().
 */
function event_log_track_taxonomy_taxonomy_vocabulary_update($vocabulary) {
  $log = array(
    'type' => 'taxonomy',
    'operation' => 'vocabulary update',
    'description' => t('%title (%name)', array(
      '%title' => $vocabulary
        ->label(),
      '%name' => $vocabulary
        ->getOriginalId(),
    )),
    'ref_char' => $vocabulary
      ->getOriginalId(),
  );
  event_log_track_insert($log);
}

/**
 * Implements hook_taxonomy_vocabulary_delete().
 */
function event_log_track_taxonomy_taxonomy_vocabulary_delete($vocabulary) {
  $log = array(
    'type' => 'taxonomy',
    'operation' => 'vocabulary delete',
    'description' => t('%title (%name)', array(
      '%title' => $vocabulary
        ->label(),
      '%name' => $vocabulary
        ->getOriginalId(),
    )),
    'ref_char' => $vocabulary
      ->getOriginalId(),
  );
  event_log_track_insert($log);
}

/**
 * Implements hook_taxonomy_term_insert().
 */
function event_log_track_taxonomy_taxonomy_term_insert($term) {
  $log = array(
    'type' => 'taxonomy',
    'operation' => 'term insert',
    'description' => t('%name (%tid)', array(
      '%name' => $term
        ->getName(),
      '%tid' => $term
        ->id(),
    )),
    'ref_numeric' => $term
      ->id(),
    'ref_char' => $term
      ->get('vid')->target_id,
  );
  event_log_track_insert($log);
}

/**
 * Implements hook_taxonomy_term_update().
 */
function event_log_track_taxonomy_taxonomy_term_update($term) {
  $log = array(
    'type' => 'taxonomy',
    'operation' => 'term update',
    'description' => t('%name (%tid)', array(
      '%name' => $term
        ->getName(),
      '%tid' => $term
        ->id(),
    )),
    'ref_numeric' => $term
      ->id(),
    'ref_char' => $term
      ->get('vid')->target_id,
  );
  event_log_track_insert($log);
}

/**
 * Implements hook_taxonomy_term_delete().
 */
function event_log_track_taxonomy_taxonomy_term_delete($term) {
  $log = array(
    'type' => 'taxonomy',
    'operation' => 'term delete',
    'description' => t('%name (%tid)', array(
      '%name' => $term
        ->getName(),
      '%tid' => $term
        ->id(),
    )),
    'ref_numeric' => $term
      ->id(),
    'ref_char' => $term
      ->get('vid')->target_id,
  );
  event_log_track_insert($log);
}

Functions

Namesort descending Description
event_log_track_taxonomy_event_log_track_handlers Implements hook_event_log_track_handlers().
event_log_track_taxonomy_taxonomy_term_delete Implements hook_taxonomy_term_delete().
event_log_track_taxonomy_taxonomy_term_insert Implements hook_taxonomy_term_insert().
event_log_track_taxonomy_taxonomy_term_update Implements hook_taxonomy_term_update().
event_log_track_taxonomy_taxonomy_vocabulary_delete Implements hook_taxonomy_vocabulary_delete().
event_log_track_taxonomy_taxonomy_vocabulary_insert Implements hook_taxonomy_vocabulary_insert().
event_log_track_taxonomy_taxonomy_vocabulary_update Implements hook_taxonomy_vocabulary_update().