Commit 8f487d28 authored by webchick's avatar webchick

Issue #2544176 by lauriii, joelpittet: Remove drupal_render_children() usage...

Issue #2544176 by lauriii, joelpittet: Remove drupal_render_children() usage in Drupal\toolbar\Element\Toolbar
parent 169bd2ae
......@@ -97,9 +97,6 @@ public static function preRenderToolbar($element) {
$element[$key]['#id'] = Html::getId('toolbar-item-' . $key);
}
// Render the children.
$element['#children'] = drupal_render_children($element);
return $element;
}
......
......@@ -87,11 +87,20 @@ function template_preprocess_toolbar(&$variables) {
$variables['tabs'] = array();
$variables['remainder'] = array();
foreach (Element::children($element) as $key) {
// Early rendering to collect the wrapper attributes from
// ToolbarItem elements.
if (!empty($element[$key])) {
Drupal::service('renderer')->render($element[$key]);
}
// Add the tray.
if (isset($element[$key]['tray'])) {
$attributes = array();
if (!empty($element[$key]['tray']['#wrapper_attributes'])) {
$attributes = $element[$key]['tray']['#wrapper_attributes'];
}
$variables['trays'][$key] = array(
'links' => $element[$key]['tray'],
'attributes' => new Attribute($element[$key]['tray']['#wrapper_attributes']),
'attributes' => new Attribute($attributes),
);
if (array_key_exists('#heading', $element[$key]['tray'])) {
$variables['trays'][$key]['label'] = $element[$key]['tray']['#heading'];
......@@ -102,7 +111,7 @@ function template_preprocess_toolbar(&$variables) {
if (isset($element[$key]['tab'])) {
$attributes = array();
// Pass the wrapper attributes along.
if (array_key_exists('#wrapper_attributes', $element[$key])) {
if (!empty($element[$key]['#wrapper_attributes'])) {
$attributes = $element[$key]['#wrapper_attributes'];
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment