コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function set(array &$elements, array $pre_bubbling_elements)
 {
     $result = parent::set($elements, $pre_bubbling_elements);
     // @todo remove this check when https://www.drupal.org/node/2367555 lands.
     if (!$this->requestStack->getCurrentRequest()->isMethodSafe()) {
         return FALSE;
     }
     if ($this->placeholderGenerator->canCreatePlaceholder($pre_bubbling_elements) && $this->placeholderGenerator->shouldAutomaticallyPlaceholder($elements)) {
         // Overwrite $elements with a placeholder. The Renderer (which called this
         // method) will update the context with the bubbleable metadata of the
         // overwritten $elements.
         $elements = $this->createPlaceholderAndRemember($this->getCacheableRenderArray($elements), $pre_bubbling_elements);
     }
     return $result;
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function set(array &$elements, array $pre_bubbling_elements)
 {
     $result = parent::set($elements, $pre_bubbling_elements);
     if ($this->placeholderGenerator->canCreatePlaceholder($pre_bubbling_elements) && $this->placeholderGenerator->shouldAutomaticallyPlaceholder($elements)) {
         // Overwrite $elements with a placeholder. The Renderer (which called this
         // method) will update the context with the bubbleable metadata of the
         // overwritten $elements.
         $elements = $this->createPlaceholderAndRemember($this->getCacheableRenderArray($elements), $pre_bubbling_elements);
     }
     return $result;
 }