40 lines
1.0 KiB
PHP
40 lines
1.0 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @file
|
|
* Callbacks for adding, editing, and deleting content and managing revisions.
|
|
*
|
|
* Also includes validation, submission and other helper functions.
|
|
*
|
|
* @see node_menu()
|
|
*/
|
|
|
|
use Drupal\Component\Utility\Xss;
|
|
use Drupal\Core\Form\FormStateInterface;
|
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
|
use Drupal\node\NodeInterface;
|
|
|
|
/**
|
|
* Prepares variables for list of available node type templates.
|
|
*
|
|
* Default template: node-add-list.html.twig.
|
|
*
|
|
* @param array $variables
|
|
* An associative array containing:
|
|
* - content: An array of content types.
|
|
*
|
|
* @see node_add_page()
|
|
*/
|
|
function template_preprocess_node_add_list(&$variables) {
|
|
$variables['types'] = array();
|
|
if (!empty($variables['content'])) {
|
|
foreach ($variables['content'] as $type) {
|
|
$variables['types'][$type->type] = array(
|
|
'type' => $type->type,
|
|
'add_link' => l($type->name, 'node/add/' . $type->type),
|
|
'description' => Xss::filterAdmin($type->description),
|
|
);
|
|
}
|
|
}
|
|
}
|