function template_preprocess_node_add_list in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/node/node.module \template_preprocess_node_add_list()
Prepares variables for list of available node type templates.
Default template: node-add-list.html.twig.
Parameters
array $variables: An associative array containing:
- content: An array of content types.
See also
node_add_page()
File
- core/
modules/ node/ node.module, line 504 - The core module that allows content to be submitted to the site.
Code
function template_preprocess_node_add_list(&$variables) {
$variables['types'] = array();
if (!empty($variables['content'])) {
foreach ($variables['content'] as $type) {
$variables['types'][$type
->id()] = array(
'type' => $type
->id(),
'add_link' => \Drupal::l($type
->label(), new Url('node.add', array(
'node_type' => $type
->id(),
))),
'description' => array(
'#markup' => $type
->getDescription(),
),
);
}
}
}