Mercurial > hg > isophonics-drupal-site
annotate core/modules/block_content/block_content.pages.inc @ 13:5fb285c0d0e3
Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've
been lucky to get away with this so far, as we don't support self-registration
which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5
was vulnerable to.
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:33:26 +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 } |