Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542
This commit is contained in:
parent
3b2511d96d
commit
81ccda77eb
2155 changed files with 54307 additions and 46870 deletions
|
@ -15,12 +15,12 @@ use Symfony\Component\HttpFoundation\RequestStack;
|
|||
/**
|
||||
* Defines a theme negotiator that deals with the active theme on ajax requests.
|
||||
*
|
||||
* Many different pages can invoke an Ajax request to system/ajax or another
|
||||
* generic Ajax path. It is almost always desired for an Ajax response to be
|
||||
* rendered using the same theme as the base page, because most themes are built
|
||||
* with the assumption that they control the entire page, so if the CSS for two
|
||||
* themes are both loaded for a given page, they may conflict with each other.
|
||||
* For example, Bartik is Drupal's default theme, and Seven is Drupal's default
|
||||
* Many different pages can invoke an Ajax request to a generic Ajax path. It is
|
||||
* almost always desired for an Ajax response to be rendered using the same
|
||||
* theme as the base page, because most themes are built with the assumption
|
||||
* that they control the entire page, so if the CSS for two themes are both
|
||||
* loaded for a given page, they may conflict with each other. For example,
|
||||
* Bartik is Drupal's default theme, and Seven is Drupal's default
|
||||
* administration theme. Depending on whether the "Use the administration theme
|
||||
* when editing or creating content" checkbox is checked, the node edit form may
|
||||
* be displayed in either theme, but the Ajax response to the Field module's
|
||||
|
|
|
@ -93,13 +93,6 @@ class ThemeManager implements ThemeManagerInterface {
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function render($hook, array $variables) {
|
||||
return $this->theme($hook, $variables);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -137,11 +130,9 @@ class ThemeManager implements ThemeManagerInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Generates themed output (internal use only).
|
||||
*
|
||||
* @see \Drupal\Core\Render\RendererInterface::render();
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function theme($hook, $variables = array()) {
|
||||
public function render($hook, array $variables) {
|
||||
static $default_attributes;
|
||||
|
||||
$active_theme = $this->getActiveTheme();
|
||||
|
@ -302,14 +293,23 @@ class ThemeManager implements ThemeManagerInterface {
|
|||
$preprocessor_function($variables, $hook, $info);
|
||||
}
|
||||
}
|
||||
// Allow theme preprocess functions to set $variables['#attached'] and use
|
||||
// it like the #attached property on render arrays. In Drupal 8, this is
|
||||
// the (only) officially supported method of attaching assets from
|
||||
// preprocess functions. Assets attached here should be associated with
|
||||
// the template that we're preprocessing variables for.
|
||||
if (isset($variables['#attached'])) {
|
||||
$preprocess_attached = ['#attached' => $variables['#attached']];
|
||||
drupal_render($preprocess_attached);
|
||||
// Allow theme preprocess functions to set $variables['#attached'] and
|
||||
// $variables['#cache'] and use them like the corresponding element
|
||||
// properties on render arrays. In Drupal 8, this is the (only) officially
|
||||
// supported method of attaching bubbleable metadata from preprocess
|
||||
// functions. Assets attached here should be associated with the template
|
||||
// that we are preprocessing variables for.
|
||||
$preprocess_bubbleable = [];
|
||||
foreach (['#attached', '#cache'] as $key) {
|
||||
if (isset($variables[$key])) {
|
||||
$preprocess_bubbleable[$key] = $variables[$key];
|
||||
}
|
||||
}
|
||||
// We do not allow preprocess functions to define cacheable elements.
|
||||
unset($preprocess_bubbleable['#cache']['keys']);
|
||||
if ($preprocess_bubbleable) {
|
||||
// @todo Inject the Renderer in https://www.drupal.org/node/2529438.
|
||||
drupal_render($preprocess_bubbleable);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue