function PreprocessHooks::preprocessEntityAddList

Same name and namespace in other branches
  1. main core/themes/default_admin/src/Hook/PreprocessHooks.php \Drupal\default_admin\Hook\PreprocessHooks::preprocessEntityAddList()

Implements hook_preprocess_HOOK() for entity_add_list.

Attributes

#[Hook('preprocess_entity_add_list')]

File

core/themes/default_admin/src/Hook/PreprocessHooks.php, line 338

Class

PreprocessHooks
Provides preprocess implementations.

Namespace

Drupal\default_admin\Hook

Code

public function preprocessEntityAddList(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.