5 * Provides page callbacks for custom blocks.
11 * Prepares variables for a custom block type creation list templates.
13 * Default template: block-content-add-list.html.twig.
15 * @param array $variables
16 * An associative array containing:
17 * - content: An array of block types.
19 * @see block_content_add_page()
21 function template_preprocess_block_content_add_list(&$variables) {
22 $variables['types'] = [];
23 $query = \Drupal::request()->query->all();
24 foreach ($variables['content'] as $type) {
25 $variables['types'][$type->id()] = [
26 'link' => \Drupal::l($type->label(), new Url('block_content.add_form', ['block_content_type' => $type->id()], ['query' => $query])),
28 '#markup' => $type->getDescription(),
30 'title' => $type->label(),
31 'localized_options' => [