Drupal → Добавляем на страницу управления отображением материала поле "Заголовок"
// MODULENAME.module /** * Implements hook_entity_base_field_info_alter(). */ function MODULENAME_entity_base_field_info_alter(array &$fields, EntityTypeInterface $entity_type): void { if ($entity_type->id() == 'node') { $fields['title']->setDisplayConfigurable('view', TRUE); } } /** * Implements hook_entity_type_build(). */ function MODULENAME_entity_type_build(array &$entity_types): void { if (isset($entity_types['node'])) { // See https://www.drupal.org/node/3043840 $entity_types['node']->set('enable_base_field_custom_preprocess_skipping', TRUE); } }
Результат:
Оставить комментарий