Update core 8.3.0

This commit is contained in:
Rob Davies 2017-04-13 15:53:35 +01:00
parent da7a7918f8
commit cd7a898e66
6144 changed files with 132297 additions and 87747 deletions

View file

@ -18,35 +18,35 @@ class Toolbar extends RenderElement {
*/
public function getInfo() {
$class = get_class($this);
return array(
'#pre_render' => array(
array($class, 'preRenderToolbar'),
),
return [
'#pre_render' => [
[$class, 'preRenderToolbar'],
],
'#theme' => 'toolbar',
'#attached' => array(
'library' => array(
'#attached' => [
'library' => [
'toolbar/toolbar',
),
),
],
],
// Metadata for the toolbar wrapping element.
'#attributes' => array(
'#attributes' => [
// The id cannot be simply "toolbar" or it will clash with the
// simpletest tests listing which produces a checkbox with attribute
// id="toolbar".
'id' => 'toolbar-administration',
'role' => 'group',
'aria-label' => $this->t('Site administration toolbar'),
),
],
// Metadata for the administration bar.
'#bar' => array(
'#bar' => [
'#heading' => $this->t('Toolbar items'),
'#attributes' => array(
'#attributes' => [
'id' => 'toolbar-bar',
'role' => 'navigation',
'aria-label' => $this->t('Toolbar items'),
),
),
);
],
],
];
}
/**
@ -68,7 +68,7 @@ class Toolbar extends RenderElement {
// toolbar presentation.
$breakpoints = static::breakpointManager()->getBreakpointsByGroup('toolbar');
if (!empty($breakpoints)) {
$media_queries = array();
$media_queries = [];
foreach ($breakpoints as $id => $breakpoint) {
$media_queries[$id] = $breakpoint->getMediaQuery();
}
@ -82,7 +82,7 @@ class Toolbar extends RenderElement {
// Allow for altering of hook_toolbar().
$module_handler->alter('toolbar', $items);
// Sort the children.
uasort($items, array('\Drupal\Component\Utility\SortArray', 'sortByWeightProperty'));
uasort($items, ['\Drupal\Component\Utility\SortArray', 'sortByWeightProperty']);
// Merge in the original toolbar values.
$element = array_merge($element, $items);

View file

@ -19,16 +19,16 @@ class ToolbarItem extends RenderElement {
*/
public function getInfo() {
$class = get_class($this);
return array(
'#pre_render' => array(
array($class, 'preRenderToolbarItem'),
),
'tab' => array(
return [
'#pre_render' => [
[$class, 'preRenderToolbarItem'],
],
'tab' => [
'#type' => 'link',
'#title' => NULL,
'#url' => Url::fromRoute('<front>'),
),
);
],
];
}
/**
@ -47,33 +47,33 @@ class ToolbarItem extends RenderElement {
$id = $element['#id'];
// Provide attributes for a toolbar item.
$attributes = array(
$attributes = [
'id' => $id,
);
];
// If tray content is present, markup the tray and its associated trigger.
if (!empty($element['tray'])) {
// Provide attributes necessary for trays.
$attributes += array(
$attributes += [
'data-toolbar-tray' => $id . '-tray',
'aria-owns' => $id . '-tray',
'role' => 'button',
'aria-pressed' => 'false',
);
];
// Merge in module-provided attributes.
$element['tab'] += array('#attributes' => array());
$element['tab'] += ['#attributes' => []];
$element['tab']['#attributes'] += $attributes;
$element['tab']['#attributes']['class'][] = 'trigger';
// Provide attributes for the tray theme wrapper.
$attributes = array(
$attributes = [
'id' => $id . '-tray',
'data-toolbar-tray' => $id . '-tray',
);
];
// Merge in module-provided attributes.
if (!isset($element['tray']['#wrapper_attributes'])) {
$element['tray']['#wrapper_attributes'] = array();
$element['tray']['#wrapper_attributes'] = [];
}
$element['tray']['#wrapper_attributes'] += $attributes;
$element['tray']['#wrapper_attributes']['class'][] = 'toolbar-tray';