taxonomy_test.module

Same filename and directory in other branches
  1. 7.x modules/simpletest/tests/taxonomy_test.module
  2. 10 core/modules/taxonomy/tests/modules/taxonomy_test/taxonomy_test.module
  3. 8.9.x core/modules/taxonomy/tests/modules/taxonomy_test/taxonomy_test.module

Provides test hook implementations for taxonomy tests.

File

core/modules/taxonomy/tests/modules/taxonomy_test/taxonomy_test.module

View source
<?php


/**
 * @file
 * Provides test hook implementations for taxonomy tests.
 */

use Drupal\Core\Database\Query\AlterableInterface;
use Drupal\Core\Form\FormStateInterface;

/**
 * Implements hook_query_alter().
 */
function taxonomy_test_query_alter(AlterableInterface $query) {
  $value = \Drupal::state()->get(__FUNCTION__);
  if (isset($value)) {
    \Drupal::state()->set(__FUNCTION__, ++$value);
  }
}

/**
 * Implements hook_query_TAG_alter().
 */
function taxonomy_test_query_term_access_alter(AlterableInterface $query) {
  $value = \Drupal::state()->get(__FUNCTION__);
  if (isset($value)) {
    \Drupal::state()->set(__FUNCTION__, ++$value);
  }
}

/**
 * Implements hook_query_TAG_alter().
 */
function taxonomy_test_query_taxonomy_term_access_alter(AlterableInterface $query) {
  $value = \Drupal::state()->get(__FUNCTION__);
  if (isset($value)) {
    \Drupal::state()->set(__FUNCTION__, ++$value);
  }
}

/**
 * Implements hook_form_BASE_FORM_ID_alter() for the taxonomy term form.
 */
function taxonomy_test_form_taxonomy_term_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  if (\Drupal::state()->get('taxonomy_test.disable_parent_form_element', FALSE)) {
    $form['relations']['parent']['#disabled'] = TRUE;
  }
}

Functions

Title Deprecated Summary
taxonomy_test_form_taxonomy_term_form_alter Implements hook_form_BASE_FORM_ID_alter() for the taxonomy term form.
taxonomy_test_query_alter Implements hook_query_alter().
taxonomy_test_query_taxonomy_term_access_alter Implements hook_query_TAG_alter().
taxonomy_test_query_term_access_alter Implements hook_query_TAG_alter().

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.