thunder_taxonomy.module in Thunder 8.4
Same filename and directory in other branches
- 8.5 modules/thunder_taxonomy/thunder_taxonomy.module
- 8.2 modules/thunder_taxonomy/thunder_taxonomy.module
- 8.3 modules/thunder_taxonomy/thunder_taxonomy.module
- 6.2.x modules/thunder_taxonomy/thunder_taxonomy.module
- 6.0.x modules/thunder_taxonomy/thunder_taxonomy.module
- 6.1.x modules/thunder_taxonomy/thunder_taxonomy.module
Module for adding custom Infinity base functions.
File
modules/thunder_taxonomy/thunder_taxonomy.moduleView source
<?php
/**
* @file
* Module for adding custom Infinity base functions.
*/
use Drupal\Core\Form\FormStateInterface;
/**
* Implements hook_entity_type_alter().
*/
function thunder_taxonomy_entity_type_alter(array &$entity_types) {
/* @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
if (!empty($entity_types['taxonomy_term'])) {
$entity_types['taxonomy_term']
->setAccessClass('Drupal\\thunder_taxonomy\\ThunderTermAccessControlHandler');
$entity_types['taxonomy_term']
->setFormClass('default', 'Drupal\\thunder_taxonomy\\ThunderTermForm');
}
}
/**
* Implements hook_form_taxonomy_overview_terms_alter().
*/
function thunder_taxonomy_form_taxonomy_overview_terms_alter(&$form, FormStateInterface $formState) {
$form['terms']['#header'] = array_merge(array_slice($form['terms']['#header'], 0, 1, TRUE), [
t('Status'),
], array_slice($form['terms']['#header'], 1, NULL, TRUE));
foreach ($form['terms'] as &$term) {
if (is_array($term) && !empty($term['#term'])) {
$status['status'] = [
'#markup' => $term['#term']->status->value ? t('Published') : t('Unpublished'),
'#type' => 'item',
];
$term = array_slice($term, 0, 1, TRUE) + $status + array_slice($term, 1, NULL, TRUE);
}
}
}
Functions
Name | Description |
---|---|
thunder_taxonomy_entity_type_alter | Implements hook_entity_type_alter(). |
thunder_taxonomy_form_taxonomy_overview_terms_alter | Implements hook_form_taxonomy_overview_terms_alter(). |