function template_preprocess_entity_add_list

Same name and namespace in other branches
  1. 9 core/modules/system/system.module \template_preprocess_entity_add_list()
  2. 8.9.x core/modules/system/system.module \template_preprocess_entity_add_list()
  3. 10 core/modules/system/system.module \template_preprocess_entity_add_list()

Prepares variables for the list of available bundles.

Default template: entity-add-list.html.twig.

Parameters

array $variables: An associative array containing:

  • bundles: An array of bundles with the label, description, add_link keys.
  • add_bundle_message: The message shown when there are no bundles. Only available if the entity type uses bundle entities.

File

core/modules/system/system.module, line 149

Code

function template_preprocess_entity_add_list(&$variables) : void {
  foreach ($variables['bundles'] as $bundle_name => $bundle_info) {
    $variables['bundles'][$bundle_name]['description'] = [
      '#markup' => $bundle_info['description'],
    ];
  }
}

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