Created
November 26, 2014 11:16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Renderer { | |
… | |
// unchanged relative to HEAD | |
public function renderRoot(&$elements) { | |
return $this->render($elements, TRUE); | |
} | |
// new! | |
public function renderPlain(&$elements) { | |
$current_stack = $this->stack; | |
$this->stack = NULL; | |
$output = $this->render($elements, TRUE); | |
$this->stack = $current_stack; | |
return $output; | |
} | |
// and in ::render(), we still have this: | |
public function render(…) { | |
… | |
if ($this->stack->count() !== 1) { | |
throw new \LogicException('A stray drupal_render() invocation with $is_root_call = TRUE is causing bubbling of attached assets to break.'); | |
} | |
… | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
::renderRoot()
may not be called inside::renderRoot()
::renderPlain()
may be called from inside anything. (Hence tokens andcheck_markup()
can be called from anything — which makes sense.)