Mercurial > hg > isophonics-drupal-site
comparison core/lib/Drupal/Core/Render/Renderer.php @ 16:c2387f117808
Routine composer update
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 15:07:59 +0100 |
parents | 1fec387a4317 |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
15:e200cb7efeb3 | 16:c2387f117808 |
---|---|
378 $elements = call_user_func($callable, $elements); | 378 $elements = call_user_func($callable, $elements); |
379 } | 379 } |
380 } | 380 } |
381 | 381 |
382 // All render elements support #markup and #plain_text. | 382 // All render elements support #markup and #plain_text. |
383 if (!empty($elements['#markup']) || !empty($elements['#plain_text'])) { | 383 if (isset($elements['#markup']) || isset($elements['#plain_text'])) { |
384 $elements = $this->ensureMarkupIsSafe($elements); | 384 $elements = $this->ensureMarkupIsSafe($elements); |
385 } | 385 } |
386 | 386 |
387 // Defaults for bubbleable rendering metadata. | 387 // Defaults for bubbleable rendering metadata. |
388 $elements['#cache']['tags'] = isset($elements['#cache']['tags']) ? $elements['#cache']['tags'] : []; | 388 $elements['#cache']['tags'] = isset($elements['#cache']['tags']) ? $elements['#cache']['tags'] : []; |
742 * @see \Drupal\Component\Utility\Html::escape() | 742 * @see \Drupal\Component\Utility\Html::escape() |
743 * @see \Drupal\Component\Utility\Xss::filter() | 743 * @see \Drupal\Component\Utility\Xss::filter() |
744 * @see \Drupal\Component\Utility\Xss::filterAdmin() | 744 * @see \Drupal\Component\Utility\Xss::filterAdmin() |
745 */ | 745 */ |
746 protected function ensureMarkupIsSafe(array $elements) { | 746 protected function ensureMarkupIsSafe(array $elements) { |
747 if (empty($elements['#markup']) && empty($elements['#plain_text'])) { | 747 if (isset($elements['#plain_text'])) { |
748 return $elements; | |
749 } | |
750 | |
751 if (!empty($elements['#plain_text'])) { | |
752 $elements['#markup'] = Markup::create(Html::escape($elements['#plain_text'])); | 748 $elements['#markup'] = Markup::create(Html::escape($elements['#plain_text'])); |
753 } | 749 } |
754 elseif (!($elements['#markup'] instanceof MarkupInterface)) { | 750 elseif (!($elements['#markup'] instanceof MarkupInterface)) { |
755 // The default behaviour is to XSS filter using the admin tag list. | 751 // The default behaviour is to XSS filter using the admin tag list. |
756 $tags = isset($elements['#allowed_tags']) ? $elements['#allowed_tags'] : Xss::getAdminTagList(); | 752 $tags = isset($elements['#allowed_tags']) ? $elements['#allowed_tags'] : Xss::getAdminTagList(); |