function template_preprocess_scheduled_update_content_add_list in Scheduled Updates 8
Prepares variables for a custom entity type creation list templates.
Default template: scheduled_update-content-add-list.html.twig.
Parameters
array $variables: An associative array containing:
- content: An array of scheduled_update-types.
See also
block_content_add_page()
File
- ./
scheduled_update.page.inc, line 45 - Contains scheduled_update.page.inc..
Code
function template_preprocess_scheduled_update_content_add_list(&$variables) {
$variables['types'] = array();
$query = \Drupal::request()->query
->all();
foreach ($variables['content'] as $type) {
$variables['types'][$type
->id()] = array(
'link' => Link::fromTextAndUrl($type
->label(), new Url('entity.scheduled_update.add_form', array(
'scheduled_update_type' => $type
->id(),
), array(
'query' => $query,
))),
'description' => array(
'#markup' => $type
->label(),
),
'title' => $type
->label(),
'localized_options' => array(
'query' => $query,
),
);
}
}