function hook_field_type_category_info_alter

Same name and namespace in other branches
  1. 10 core/modules/field/field.api.php \hook_field_type_category_info_alter()

Allows modules to alter the field type category information.

This hook provides a way for modules to modify or add to the existing category information. Modules can use this hook to modify the properties of existing categories. It can also be used to define custom field type categories although the use of YAML-based plugins should be preferred over the hook.

Parameters

array &$categories: An associative array of field type categories, keyed by category machine name.

See also

\Drupal\Core\Field\FieldTypeCategoryManager

Related topics

4 functions implement hook_field_type_category_info_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

comment_field_type_category_info_alter in core/modules/comment/comment.module
Implements hook_field_type_category_info_alter().
link_field_type_category_info_alter in core/modules/link/link.module
Implements hook_field_type_category_info_alter().
media_field_type_category_info_alter in core/modules/media/media.module
Implements hook_field_type_category_info_alter().
telephone_field_type_category_info_alter in core/modules/telephone/telephone.module
Implements hook_field_type_category_info_alter().

File

core/modules/field/field.api.php, line 448

Code

function hook_field_type_category_info_alter(array &$categories) {
    // Modify or add field type categories.
    $categories['my_custom_category'] = [
        'label' => 'My Custom Category',
        'description' => 'This is a custom category for my field types.',
    ];
    // Modify the properties of an existing category.
    $categories['text']['description'] = 'Modified Text';
}

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