Update core 8.3.0
This commit is contained in:
parent
da7a7918f8
commit
cd7a898e66
6144 changed files with 132297 additions and 87747 deletions
|
@ -90,7 +90,7 @@ function template_preprocess_views_view_fields(&$variables) {
|
|||
|
||||
// Loop through the fields for this view.
|
||||
$previous_inline = FALSE;
|
||||
$variables['fields'] = array(); // ensure it's at least an empty array.
|
||||
$variables['fields'] = []; // ensure it's at least an empty array.
|
||||
/** @var \Drupal\views\ResultRow $row */
|
||||
$row = $variables['row'];
|
||||
foreach ($view->field as $id => $field) {
|
||||
|
@ -107,7 +107,7 @@ function template_preprocess_views_view_fields(&$variables) {
|
|||
|
||||
$object->element_type = $object->handler->elementType(TRUE, !$variables['options']['default_field_elements'], $object->inline);
|
||||
if ($object->element_type) {
|
||||
$attributes = array();
|
||||
$attributes = [];
|
||||
if ($object->handler->options['element_default_classes']) {
|
||||
$attributes['class'][] = 'field-content';
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ function template_preprocess_views_view_fields(&$variables) {
|
|||
|
||||
// Set up field wrapper attributes if field wrapper was set.
|
||||
if ($object->wrapper_element) {
|
||||
$attributes = array();
|
||||
$attributes = [];
|
||||
if ($object->handler->options['element_default_classes']) {
|
||||
$attributes['class'][] = 'views-field';
|
||||
$attributes['class'][] = 'views-field-' . $object->class;
|
||||
|
@ -169,7 +169,7 @@ function template_preprocess_views_view_fields(&$variables) {
|
|||
|
||||
// Set up label attributes.
|
||||
if ($object->label_element) {
|
||||
$attributes = array();
|
||||
$attributes = [];
|
||||
if ($object->handler->options['element_default_classes']) {
|
||||
$attributes['class'][] = 'views-label';
|
||||
$attributes['class'][] = 'views-label-' . $object->class;
|
||||
|
@ -241,13 +241,13 @@ function template_preprocess_views_view_summary(&$variables) {
|
|||
$view = $variables['view'];
|
||||
$argument = $view->argument[$view->build_info['summary_level']];
|
||||
|
||||
$url_options = array();
|
||||
$url_options = [];
|
||||
|
||||
if (!empty($view->exposed_raw_input)) {
|
||||
$url_options['query'] = $view->exposed_raw_input;
|
||||
}
|
||||
|
||||
$active_urls = array(
|
||||
$active_urls = [
|
||||
// Force system path.
|
||||
\Drupal::url('<current>', [], ['alias' => TRUE]),
|
||||
// Force system path.
|
||||
|
@ -256,13 +256,13 @@ function template_preprocess_views_view_summary(&$variables) {
|
|||
\Drupal::url('<current>'),
|
||||
// Could be an alias.
|
||||
Url::fromRouteMatch(\Drupal::routeMatch())->toString(),
|
||||
);
|
||||
];
|
||||
$active_urls = array_combine($active_urls, $active_urls);
|
||||
|
||||
// Collect all arguments foreach row, to be able to alter them for example
|
||||
// by the validator. This is not done per single argument value, because this
|
||||
// could cause performance problems.
|
||||
$row_args = array();
|
||||
$row_args = [];
|
||||
|
||||
foreach ($variables['rows'] as $id => $row) {
|
||||
$row_args[$id] = $argument->summaryArgument($row);
|
||||
|
@ -270,7 +270,7 @@ function template_preprocess_views_view_summary(&$variables) {
|
|||
$argument->processSummaryArguments($row_args);
|
||||
|
||||
foreach ($variables['rows'] as $id => $row) {
|
||||
$variables['rows'][$id]->attributes = array();
|
||||
$variables['rows'][$id]->attributes = [];
|
||||
$variables['rows'][$id]->link = $argument->summaryName($row);
|
||||
$args = $view->args;
|
||||
$args[$argument->position] = $row_args[$id];
|
||||
|
@ -329,25 +329,25 @@ function template_preprocess_views_view_summary_unformatted(&$variables) {
|
|||
$view = $variables['view'];
|
||||
$argument = $view->argument[$view->build_info['summary_level']];
|
||||
|
||||
$url_options = array();
|
||||
$url_options = [];
|
||||
|
||||
if (!empty($view->exposed_raw_input)) {
|
||||
$url_options['query'] = $view->exposed_raw_input;
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
$active_urls = array(
|
||||
$active_urls = [
|
||||
// Force system path.
|
||||
\Drupal::url('<current>', [], ['alias' => TRUE]),
|
||||
// Could be an alias.
|
||||
\Drupal::url('<current>'),
|
||||
);
|
||||
];
|
||||
$active_urls = array_combine($active_urls, $active_urls);
|
||||
|
||||
// Collect all arguments for each row, to be able to alter them for example
|
||||
// by the validator. This is not done per single argument value, because
|
||||
// this could cause performance problems.
|
||||
$row_args = array();
|
||||
$row_args = [];
|
||||
foreach ($variables['rows'] as $id => $row) {
|
||||
$row_args[$id] = $argument->summaryArgument($row);
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ function template_preprocess_views_view_summary_unformatted(&$variables) {
|
|||
if ($count++) {
|
||||
$variables['rows'][$id]->separator = Xss::filterAdmin($variables['options']['separator']);
|
||||
}
|
||||
$variables['rows'][$id]->attributes = array();
|
||||
$variables['rows'][$id]->attributes = [];
|
||||
$variables['rows'][$id]->link = $argument->summaryName($row);
|
||||
$args = $view->args;
|
||||
$args[$argument->position] = $row_args[$id];
|
||||
|
@ -417,8 +417,8 @@ function template_preprocess_views_view_table(&$variables) {
|
|||
// so that it can get rebuilt.
|
||||
// Store rows so that they may be used by further preprocess functions.
|
||||
$result = $variables['result'] = $variables['rows'];
|
||||
$variables['rows'] = array();
|
||||
$variables['header'] = array();
|
||||
$variables['rows'] = [];
|
||||
$variables['header'] = [];
|
||||
|
||||
$options = $view->style_plugin->options;
|
||||
$handler = $view->style_plugin;
|
||||
|
@ -466,19 +466,19 @@ function template_preprocess_views_view_table(&$variables) {
|
|||
$initial = ($order == 'asc') ? 'desc' : 'asc';
|
||||
}
|
||||
|
||||
$title = t('sort by @s', array('@s' => $label));
|
||||
$title = t('sort by @s', ['@s' => $label]);
|
||||
if ($active == $field) {
|
||||
$variables['header'][$field]['sort_indicator'] = array(
|
||||
$variables['header'][$field]['sort_indicator'] = [
|
||||
'#theme' => 'tablesort_indicator',
|
||||
'#style' => $initial,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
$query['order'] = $field;
|
||||
$query['sort'] = $initial;
|
||||
$link_options = array(
|
||||
$link_options = [
|
||||
'query' => $query,
|
||||
);
|
||||
];
|
||||
$url = new Url($route_name, [], $link_options);
|
||||
$variables['header'][$field]['url'] = $url->toString();
|
||||
$variables['header'][$field]['content'] = $label;
|
||||
|
@ -487,7 +487,7 @@ function template_preprocess_views_view_table(&$variables) {
|
|||
|
||||
$variables['header'][$field]['default_classes'] = $fields[$field]->options['element_default_classes'];
|
||||
// Set up the header label class.
|
||||
$variables['header'][$field]['attributes'] = array();
|
||||
$variables['header'][$field]['attributes'] = [];
|
||||
$class = $fields[$field]->elementLabelClasses(0);
|
||||
if ($class) {
|
||||
$variables['header'][$field]['attributes']['class'][] = $class;
|
||||
|
@ -543,7 +543,7 @@ function template_preprocess_views_view_table(&$variables) {
|
|||
|
||||
// Add field classes.
|
||||
if (!isset($column_reference['attributes'])) {
|
||||
$column_reference['attributes'] = array();
|
||||
$column_reference['attributes'] = [];
|
||||
}
|
||||
|
||||
if ($classes = $fields[$field]->elementClasses($num)) {
|
||||
|
@ -557,7 +557,7 @@ function template_preprocess_views_view_table(&$variables) {
|
|||
|
||||
// Improves accessibility of complex tables.
|
||||
if (isset($variables['header'][$field]['attributes']['id'])) {
|
||||
$column_reference['attributes']['headers'] = array($variables['header'][$field]['attributes']['id']);
|
||||
$column_reference['attributes']['headers'] = [$variables['header'][$field]['attributes']['id']];
|
||||
}
|
||||
|
||||
if (!empty($fields[$field])) {
|
||||
|
@ -604,11 +604,11 @@ function template_preprocess_views_view_table(&$variables) {
|
|||
|
||||
// Hide table header if all labels are empty.
|
||||
if (!$has_header_labels) {
|
||||
$variables['header'] = array();
|
||||
$variables['header'] = [];
|
||||
}
|
||||
|
||||
foreach ($variables['rows'] as $num => $row) {
|
||||
$variables['rows'][$num]['attributes'] = array();
|
||||
$variables['rows'][$num]['attributes'] = [];
|
||||
if ($row_class = $handler->getRowClass($num)) {
|
||||
$variables['rows'][$num]['attributes']['class'][] = $row_class;
|
||||
}
|
||||
|
@ -618,12 +618,12 @@ function template_preprocess_views_view_table(&$variables) {
|
|||
if (empty($variables['rows']) && !empty($options['empty_table'])) {
|
||||
$build = $view->display_handler->renderArea('empty');
|
||||
$variables['rows'][0]['columns'][0]['content'][0]['field_output'] = $build;
|
||||
$variables['rows'][0]['attributes'] = new Attribute(array('class' => 'odd'));
|
||||
$variables['rows'][0]['attributes'] = new Attribute(['class' => ['odd']]);
|
||||
// Calculate the amounts of rows with output.
|
||||
$variables['rows'][0]['columns'][0]['attributes'] = new Attribute(array(
|
||||
$variables['rows'][0]['columns'][0]['attributes'] = new Attribute([
|
||||
'colspan' => count($variables['header']),
|
||||
'class' => 'views-empty',
|
||||
));
|
||||
'class' => ['views-empty'],
|
||||
]);
|
||||
}
|
||||
|
||||
$variables['sticky'] = FALSE;
|
||||
|
@ -678,7 +678,7 @@ function template_preprocess_views_view_grid(&$variables) {
|
|||
|
||||
$col = 0;
|
||||
$row = 0;
|
||||
$items = array();
|
||||
$items = [];
|
||||
$remainders = count($variables['rows']) % $options['columns'];
|
||||
$num_rows = floor(count($variables['rows']) / $options['columns']);
|
||||
|
||||
|
@ -695,7 +695,7 @@ function template_preprocess_views_view_grid(&$variables) {
|
|||
|
||||
// Create attributes for rows.
|
||||
if (!$horizontal || ($horizontal && empty($items[$row]['attributes']))) {
|
||||
$row_attributes = array('class' => array());
|
||||
$row_attributes = ['class' => []];
|
||||
// Add custom row classes.
|
||||
$row_class = array_filter(explode(' ', $variables['view']->style_plugin->getCustomClass($result_index, 'row')));
|
||||
if (!empty($row_class)) {
|
||||
|
@ -712,7 +712,7 @@ function template_preprocess_views_view_grid(&$variables) {
|
|||
|
||||
// Create attributes for columns.
|
||||
if ($horizontal || (!$horizontal && empty($items[$col]['attributes']))) {
|
||||
$col_attributes = array('class' => array());
|
||||
$col_attributes = ['class' => []];
|
||||
// Add default views column classes.
|
||||
// Add custom column classes.
|
||||
$col_class = array_filter(explode(' ', $variables['view']->style_plugin->getCustomClass($result_index, 'col')));
|
||||
|
@ -781,7 +781,7 @@ function template_preprocess_views_view_unformatted(&$variables) {
|
|||
|
||||
$variables['default_row_class'] = !empty($options['default_row_class']);
|
||||
foreach ($rows as $id => $row) {
|
||||
$variables['rows'][$id] = array();
|
||||
$variables['rows'][$id] = [];
|
||||
$variables['rows'][$id]['content'] = $row;
|
||||
$variables['rows'][$id]['attributes'] = new Attribute();
|
||||
if ($row_class = $view->style_plugin->getRowClass($id)) {
|
||||
|
@ -808,7 +808,7 @@ function template_preprocess_views_view_list(&$variables) {
|
|||
$class = array_map('\Drupal\Component\Utility\Html::cleanCssIdentifier', $class);
|
||||
|
||||
// Initialize a new attribute class for $class.
|
||||
$variables['list']['attributes'] = new Attribute(array('class' => $class));
|
||||
$variables['list']['attributes'] = new Attribute(['class' => $class]);
|
||||
}
|
||||
|
||||
// Fetch wrapper classes from handler options.
|
||||
|
@ -864,7 +864,7 @@ function template_preprocess_views_view_rss(&$variables) {
|
|||
|
||||
/** @var \Drupal\Core\Url $url */
|
||||
if ($url) {
|
||||
$url_options = array('absolute' => TRUE);
|
||||
$url_options = ['absolute' => TRUE];
|
||||
if (!empty($view->exposed_raw_input)) {
|
||||
$url_options['query'] = $view->exposed_raw_input;
|
||||
}
|
||||
|
@ -913,7 +913,7 @@ function template_preprocess_views_view_row_rss(&$variables) {
|
|||
$variables['description'] = (string) \Drupal::service('renderer')->render($item->description);
|
||||
}
|
||||
|
||||
$variables['item_elements'] = array();
|
||||
$variables['item_elements'] = [];
|
||||
foreach ($item->elements as $element) {
|
||||
if (isset($element['attributes']) && is_array($element['attributes'])) {
|
||||
$element['attributes'] = new Attribute($element['attributes']);
|
||||
|
@ -1022,9 +1022,9 @@ function template_preprocess_views_mini_pager(&$variables) {
|
|||
$variables['items']['current'] = $pager_page_array[$element] + 1;
|
||||
|
||||
if ($pager_total[$element] > 1 && $pager_page_array[$element] > 0) {
|
||||
$options = array(
|
||||
$options = [
|
||||
'query' => pager_query_add_page($parameters, $element, $pager_page_array[$element] - 1),
|
||||
);
|
||||
];
|
||||
$variables['items']['previous']['href'] = \Drupal::url('<current>', [], $options);
|
||||
if (isset($tags[1])) {
|
||||
$variables['items']['previous']['text'] = $tags[1];
|
||||
|
@ -1033,9 +1033,9 @@ function template_preprocess_views_mini_pager(&$variables) {
|
|||
}
|
||||
|
||||
if ($pager_page_array[$element] < ($pager_total[$element] - 1)) {
|
||||
$options = array(
|
||||
$options = [
|
||||
'query' => pager_query_add_page($parameters, $element, $pager_page_array[$element] + 1),
|
||||
);
|
||||
];
|
||||
$variables['items']['next']['href'] = \Drupal::url('<current>', [], $options);
|
||||
if (isset($tags[3])) {
|
||||
$variables['items']['next']['text'] = $tags[3];
|
||||
|
|
Reference in a new issue