function PreprocessHooks::entityAddList

Same name and namespace in other branches
  1. 11.x core/themes/admin/src/Hook/PreprocessHooks.php \Drupal\admin\Hook\PreprocessHooks::entityAddList()

Implements hook_preprocess_HOOK() for entity_add_list.

Attributes

#[Hook('preprocess_entity_add_list')]

File

core/themes/admin/src/Hook/PreprocessHooks.php, line 350

Class

PreprocessHooks
Provides preprocess implementations.

Namespace

Drupal\admin\Hook

Code

public function entityAddList(array &$variables) : void {
  // Remove description if empty.
  foreach ($variables['bundles'] as $type_id => $values) {
    if (isset($values['description']['#markup']) && empty($values['description']['#markup'])) {
      $variables['bundles'][$type_id]['description'] = [];
    }
  }
}

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