You are here

function seven_preprocess_node_add_list in Drupal 8

Same name and namespace in other branches
  1. 9 core/themes/seven/seven.theme \seven_preprocess_node_add_list()
  2. 10 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
Functions to support theming in the Seven theme.

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();
    }
  }
}