Mercurial > hg > isophonics-drupal-site
annotate core/modules/block_content/block_content.pages.inc @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 4c8ae668cc8c |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 /** |
Chris@0 | 4 * @file |
Chris@0 | 5 * Provides page callbacks for custom blocks. |
Chris@0 | 6 */ |
Chris@0 | 7 |
Chris@0 | 8 use Drupal\Core\Url; |
Chris@0 | 9 |
Chris@0 | 10 /** |
Chris@0 | 11 * Prepares variables for a custom block type creation list templates. |
Chris@0 | 12 * |
Chris@0 | 13 * Default template: block-content-add-list.html.twig. |
Chris@0 | 14 * |
Chris@0 | 15 * @param array $variables |
Chris@0 | 16 * An associative array containing: |
Chris@0 | 17 * - content: An array of block types. |
Chris@0 | 18 * |
Chris@0 | 19 * @see block_content_add_page() |
Chris@0 | 20 */ |
Chris@0 | 21 function template_preprocess_block_content_add_list(&$variables) { |
Chris@0 | 22 $variables['types'] = []; |
Chris@0 | 23 $query = \Drupal::request()->query->all(); |
Chris@0 | 24 foreach ($variables['content'] as $type) { |
Chris@0 | 25 $variables['types'][$type->id()] = [ |
Chris@0 | 26 'link' => \Drupal::l($type->label(), new Url('block_content.add_form', ['block_content_type' => $type->id()], ['query' => $query])), |
Chris@0 | 27 'description' => [ |
Chris@0 | 28 '#markup' => $type->getDescription(), |
Chris@0 | 29 ], |
Chris@0 | 30 'title' => $type->label(), |
Chris@0 | 31 'localized_options' => [ |
Chris@0 | 32 'query' => $query, |
Chris@0 | 33 ], |
Chris@0 | 34 ]; |
Chris@0 | 35 } |
Chris@0 | 36 } |