function TaxonomyFieldHooks::preConfiguredDescription
Implements hook_field_ui_preconfigured_options_alter().
Attributes
#[Hook('field_ui_preconfigured_options_alter')]
File
-
core/
modules/ taxonomy/ src/ Hook/ TaxonomyFieldHooks.php, line 26
Class
- TaxonomyFieldHooks
- Field and Field UI hook implementations for Taxonomy module.
Namespace
Drupal\taxonomy\HookCode
public function preConfiguredDescription(array &$options, $field_type) : void {
// If the field is not an "entity_reference"-based field, then bail out.
$class = $this->fieldTypeManager
->getPluginClass($field_type);
if (!is_a($class, EntityReferenceItem::class, TRUE)) {
return;
}
// Set the description for the "Add field" page.
if (!empty($options['taxonomy_term'])) {
$options['taxonomy_term']['description'] = [
$this->t('Attach a term from any vocabulary'),
$this->t('Examples: free tag, site section, article topic'),
];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.