taxonomy_term_display_configurable_test.module

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

Tests configurable displays for taxonomy_term base fields.

File

core/modules/taxonomy/tests/modules/taxonomy_term_display_configurable_test/taxonomy_term_display_configurable_test.module

View source
<?php


/**
 * @file
 * Tests configurable displays for taxonomy_term base fields.
 */
use Drupal\Core\Entity\EntityTypeInterface;

/**
 * Implements hook_entity_base_field_info_alter().
 */
function taxonomy_term_display_configurable_test_entity_base_field_info_alter(&$base_field_definitions, EntityTypeInterface $entity_type) {
    if ($entity_type->id() === 'taxonomy_term') {
        
        /** @var \Drupal\Core\Field\BaseFieldDefinition[] $base_field_definitions */
        $base_field_definitions['name']->setDisplayConfigurable('view', TRUE);
    }
}

/**
 * Implements hook_entity_type_build().
 */
function taxonomy_term_display_configurable_test_entity_type_build(array &$entity_types) {
    // Allow skipping of extra preprocessing for configurable display.
    $entity_types['taxonomy_term']->set('enable_base_field_custom_preprocess_skipping', TRUE);
}

Functions

Title Deprecated Summary
taxonomy_term_display_configurable_test_entity_base_field_info_alter Implements hook_entity_base_field_info_alter().
taxonomy_term_display_configurable_test_entity_type_build Implements hook_entity_type_build().

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