function seven_preprocess_node_add_list

Same name and namespace in other branches
  1. 8.9.x core/themes/seven/seven.theme \seven_preprocess_node_add_list()

Implements hook_preprocess_HOOK() for list of available node type templates.

File

core/themes/seven/seven.theme, line 63

Code

function seven_preprocess_node_add_list(&$variables) {
  if (!empty($variables['content'])) {
    /** @var \Drupal\node\NodeTypeInterface $type */
    foreach ($variables['content'] as $type) {
      $variables['types'][$type->id()]['label'] = $type->label();
      $variables['types'][$type->id()]['url'] = Url::fromRoute('node.add', [
        'node_type' => $type->id(),
      ])
        ->toString();
    }
  }
}

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