Mercurial > hg > isophonics-drupal-site
diff core/modules/contextual/src/Element/ContextualLinksPlaceholder.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 4c8ae668cc8c |
children |
line wrap: on
line diff
--- a/core/modules/contextual/src/Element/ContextualLinksPlaceholder.php Tue Jul 10 15:07:59 2018 +0100 +++ b/core/modules/contextual/src/Element/ContextualLinksPlaceholder.php Thu Feb 28 13:21:36 2019 +0000 @@ -2,9 +2,11 @@ namespace Drupal\contextual\Element; +use Drupal\Component\Utility\Crypt; +use Drupal\Core\Site\Settings; use Drupal\Core\Template\Attribute; use Drupal\Core\Render\Element\RenderElement; -use Drupal\Component\Utility\SafeMarkup; +use Drupal\Component\Render\FormattableMarkup; /** * Provides a contextual_links_placeholder element. @@ -43,7 +45,12 @@ * @see _contextual_links_to_id() */ public static function preRenderPlaceholder(array $element) { - $element['#markup'] = SafeMarkup::format('<div@attributes></div>', ['@attributes' => new Attribute(['data-contextual-id' => $element['#id']])]); + $token = Crypt::hmacBase64($element['#id'], Settings::getHashSalt() . \Drupal::service('private_key')->get()); + $attribute = new Attribute([ + 'data-contextual-id' => $element['#id'], + 'data-contextual-token' => $token, + ]); + $element['#markup'] = new FormattableMarkup('<div@attributes></div>', ['@attributes' => $attribute]); return $element; }