Update core 8.3.0
This commit is contained in:
parent
da7a7918f8
commit
cd7a898e66
6144 changed files with 132297 additions and 87747 deletions
|
@ -5,7 +5,6 @@ namespace Drupal\views;
|
|||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\Component\Utility\Tags;
|
||||
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
|
||||
use Drupal\Core\Form\FormState;
|
||||
use Drupal\Core\Routing\RouteProviderInterface;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\views\Plugin\views\display\DisplayRouterInterface;
|
||||
|
@ -52,14 +51,14 @@ class ViewExecutable implements \Serializable {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public $args = array();
|
||||
public $args = [];
|
||||
|
||||
/**
|
||||
* An array of build info.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $build_info = array();
|
||||
public $build_info = [];
|
||||
|
||||
/**
|
||||
* Whether this view uses AJAX.
|
||||
|
@ -75,7 +74,7 @@ class ViewExecutable implements \Serializable {
|
|||
*
|
||||
* @var \Drupal\views\ResultRow[]
|
||||
*/
|
||||
public $result = array();
|
||||
public $result = [];
|
||||
|
||||
// May be used to override the current pager info.
|
||||
|
||||
|
@ -112,21 +111,21 @@ class ViewExecutable implements \Serializable {
|
|||
*
|
||||
* @var array()
|
||||
*/
|
||||
public $attachment_before = array();
|
||||
public $attachment_before = [];
|
||||
|
||||
/**
|
||||
* Attachments to place after the view.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $attachment_after = array();
|
||||
public $attachment_after = [];
|
||||
|
||||
/**
|
||||
* Feed icons attached to the view.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $feedIcons = array();
|
||||
public $feedIcons = [];
|
||||
|
||||
// Exposed widget input
|
||||
|
||||
|
@ -135,35 +134,35 @@ class ViewExecutable implements \Serializable {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public $exposed_data = array();
|
||||
public $exposed_data = [];
|
||||
|
||||
/**
|
||||
* An array of input values from exposed forms.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $exposed_input = array();
|
||||
protected $exposed_input = [];
|
||||
|
||||
/**
|
||||
* Exposed widget input directly from the $form_state->getValues().
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $exposed_raw_input = array();
|
||||
public $exposed_raw_input = [];
|
||||
|
||||
/**
|
||||
* Used to store views that were previously running if we recurse.
|
||||
*
|
||||
* @var \Drupal\views\ViewExecutable[]
|
||||
*/
|
||||
public $old_view = array();
|
||||
public $old_view = [];
|
||||
|
||||
/**
|
||||
* To avoid recursion in views embedded into areas.
|
||||
*
|
||||
* @var \Drupal\views\ViewExecutable[]
|
||||
*/
|
||||
public $parent_views = array();
|
||||
public $parent_views = [];
|
||||
|
||||
/**
|
||||
* Whether this view is an attachment to another view.
|
||||
|
@ -681,7 +680,7 @@ class ViewExecutable implements \Serializable {
|
|||
|
||||
$this->exposed_input = \Drupal::request()->query->all();
|
||||
// unset items that are definitely not our input:
|
||||
foreach (array('page', 'q') as $key) {
|
||||
foreach (['page', 'q'] as $key) {
|
||||
if (isset($this->exposed_input[$key])) {
|
||||
unset($this->exposed_input[$key]);
|
||||
}
|
||||
|
@ -789,7 +788,7 @@ class ViewExecutable implements \Serializable {
|
|||
|
||||
// Ensure the requested display exists.
|
||||
if (!$this->displayHandlers->has($display_id)) {
|
||||
debug(format_string('setDisplay() called with invalid display ID "@display".', array('@display' => $display_id)));
|
||||
debug(format_string('setDisplay() called with invalid display ID "@display".', ['@display' => $display_id]));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -957,10 +956,10 @@ class ViewExecutable implements \Serializable {
|
|||
* An array of base tables to be used by the view.
|
||||
*/
|
||||
public function getBaseTables() {
|
||||
$base_tables = array(
|
||||
$base_tables = [
|
||||
$this->storage->get('base_table') => TRUE,
|
||||
'#global' => TRUE,
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($this->display_handler->getHandlers('relationship') as $handler) {
|
||||
$base_tables[$handler->definition['base']] = TRUE;
|
||||
|
@ -1055,7 +1054,7 @@ class ViewExecutable implements \Serializable {
|
|||
|
||||
// build arguments.
|
||||
$position = -1;
|
||||
$substitutions = array();
|
||||
$substitutions = [];
|
||||
$status = TRUE;
|
||||
|
||||
// Get the title.
|
||||
|
@ -1193,18 +1192,18 @@ class ViewExecutable implements \Serializable {
|
|||
|
||||
// Let modules modify the view just prior to building it.
|
||||
$module_handler = \Drupal::moduleHandler();
|
||||
$module_handler->invokeAll('views_pre_build', array($this));
|
||||
$module_handler->invokeAll('views_pre_build', [$this]);
|
||||
|
||||
// Attempt to load from cache.
|
||||
// @todo Load a build_info from cache.
|
||||
|
||||
$start = microtime(TRUE);
|
||||
// If that fails, let's build!
|
||||
$this->build_info = array(
|
||||
$this->build_info = [
|
||||
'query' => '',
|
||||
'count_query' => '',
|
||||
'query_args' => array(),
|
||||
);
|
||||
'query_args' => [],
|
||||
];
|
||||
|
||||
$this->initQuery();
|
||||
|
||||
|
@ -1223,7 +1222,7 @@ class ViewExecutable implements \Serializable {
|
|||
/** @var \Drupal\views\Plugin\views\exposed_form\ExposedFormPluginInterface $exposed_form */
|
||||
$exposed_form = $this->display_handler->getPlugin('exposed_form');
|
||||
$this->exposed_widgets = $exposed_form->renderExposedForm();
|
||||
if (FormState::hasAnyErrors() || !empty($this->build_info['abort'])) {
|
||||
if (!empty($this->build_info['abort'])) {
|
||||
$this->built = TRUE;
|
||||
// Don't execute the query, $form_state, but rendering will still be executed to display the empty text.
|
||||
$this->executed = TRUE;
|
||||
|
@ -1315,7 +1314,7 @@ class ViewExecutable implements \Serializable {
|
|||
$this->attachDisplays();
|
||||
|
||||
// Let modules modify the view just after building it.
|
||||
$module_handler->invokeAll('views_post_build', array($this));
|
||||
$module_handler->invokeAll('views_post_build', [$this]);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1336,7 +1335,7 @@ class ViewExecutable implements \Serializable {
|
|||
foreach ($handlers as $id => $data) {
|
||||
|
||||
if (!empty($handlers[$id]) && is_object($handlers[$id])) {
|
||||
$multiple_exposed_input = array(0 => NULL);
|
||||
$multiple_exposed_input = [0 => NULL];
|
||||
if ($handlers[$id]->multipleExposedInput()) {
|
||||
$multiple_exposed_input = $handlers[$id]->groupMultipleExposedInput($this->exposed_data);
|
||||
}
|
||||
|
@ -1392,7 +1391,7 @@ class ViewExecutable implements \Serializable {
|
|||
|
||||
// Let modules modify the view just prior to executing it.
|
||||
$module_handler = \Drupal::moduleHandler();
|
||||
$module_handler->invokeAll('views_pre_execute', array($this));
|
||||
$module_handler->invokeAll('views_pre_execute', [$this]);
|
||||
|
||||
// Check for already-cached results.
|
||||
/** @var \Drupal\views\Plugin\views\cache\CachePluginBase $cache */
|
||||
|
@ -1419,7 +1418,7 @@ class ViewExecutable implements \Serializable {
|
|||
}
|
||||
|
||||
// Let modules modify the view just after executing it.
|
||||
$module_handler->invokeAll('views_post_execute', array($this));
|
||||
$module_handler->invokeAll('views_post_execute', [$this]);
|
||||
|
||||
return $this->executed = TRUE;
|
||||
}
|
||||
|
@ -1495,7 +1494,7 @@ class ViewExecutable implements \Serializable {
|
|||
$this->style_plugin->preRender($this->result);
|
||||
|
||||
// Let each area handler have access to the result set.
|
||||
$areas = array('header', 'footer');
|
||||
$areas = ['header', 'footer'];
|
||||
// Only call preRender() on the empty handlers if the result is empty.
|
||||
if (empty($this->result)) {
|
||||
$areas[] = 'empty';
|
||||
|
@ -1507,7 +1506,7 @@ class ViewExecutable implements \Serializable {
|
|||
}
|
||||
|
||||
// Let modules modify the view just prior to rendering it.
|
||||
$module_handler->invokeAll('views_pre_render', array($this));
|
||||
$module_handler->invokeAll('views_pre_render', [$this]);
|
||||
|
||||
// Let the themes play too, because pre render is a very themey thing.
|
||||
foreach ($themes as $theme_name) {
|
||||
|
@ -1524,7 +1523,7 @@ class ViewExecutable implements \Serializable {
|
|||
$cache->postRender($this->display_handler->output);
|
||||
|
||||
// Let modules modify the view output after it is rendered.
|
||||
$module_handler->invokeAll('views_post_render', array($this, &$this->display_handler->output, $cache));
|
||||
$module_handler->invokeAll('views_post_render', [$this, &$this->display_handler->output, $cache]);
|
||||
|
||||
// Let the themes play too, because post render is a very themey thing.
|
||||
foreach ($themes as $theme_name) {
|
||||
|
@ -1571,7 +1570,7 @@ class ViewExecutable implements \Serializable {
|
|||
* A renderable array with #type 'view' or NULL if the display ID was
|
||||
* invalid.
|
||||
*/
|
||||
public function buildRenderable($display_id = NULL, $args = array(), $cache = TRUE) {
|
||||
public function buildRenderable($display_id = NULL, $args = [], $cache = TRUE) {
|
||||
// @todo Extract that into a generic method.
|
||||
if (empty($this->current_display) || $this->current_display != $this->chooseDisplay($display_id)) {
|
||||
if (!$this->setDisplay($display_id)) {
|
||||
|
@ -1604,7 +1603,7 @@ class ViewExecutable implements \Serializable {
|
|||
* A renderable array containing the view output or NULL if the display ID
|
||||
* of the view to be executed doesn't exist.
|
||||
*/
|
||||
public function executeDisplay($display_id = NULL, $args = array()) {
|
||||
public function executeDisplay($display_id = NULL, $args = []) {
|
||||
if (empty($this->current_display) || $this->current_display != $this->chooseDisplay($display_id)) {
|
||||
if (!$this->setDisplay($display_id)) {
|
||||
return NULL;
|
||||
|
@ -1636,7 +1635,7 @@ class ViewExecutable implements \Serializable {
|
|||
* A renderable array containing the view output or NULL if the display ID
|
||||
* of the view to be executed doesn't exist.
|
||||
*/
|
||||
public function preview($display_id = NULL, $args = array()) {
|
||||
public function preview($display_id = NULL, $args = []) {
|
||||
if (empty($this->current_display) || ((!empty($display_id)) && $this->current_display != $display_id)) {
|
||||
if (!$this->setDisplay($display_id)) {
|
||||
return FALSE;
|
||||
|
@ -1658,7 +1657,7 @@ class ViewExecutable implements \Serializable {
|
|||
* @param array $args
|
||||
* An array of arguments from the URL that can be used by the view.
|
||||
*/
|
||||
public function preExecute($args = array()) {
|
||||
public function preExecute($args = []) {
|
||||
$this->old_view[] = views_get_current_view();
|
||||
views_set_current_view($this);
|
||||
$display_id = $this->current_display;
|
||||
|
@ -1670,7 +1669,7 @@ class ViewExecutable implements \Serializable {
|
|||
}
|
||||
|
||||
// Let modules modify the view just prior to executing it.
|
||||
\Drupal::moduleHandler()->invokeAll('views_pre_view', array($this, $display_id, &$this->args));
|
||||
\Drupal::moduleHandler()->invokeAll('views_pre_view', [$this, $display_id, &$this->args]);
|
||||
|
||||
// Allow hook_views_pre_view() to set the dom_id, then ensure it is set.
|
||||
$this->dom_id = !empty($this->dom_id) ? $this->dom_id : hash('sha256', $this->storage->id() . REQUEST_TIME . mt_rand());
|
||||
|
@ -1948,7 +1947,7 @@ class ViewExecutable implements \Serializable {
|
|||
return $display_handler->getUrlInfo();
|
||||
}
|
||||
|
||||
$argument_keys = isset($this->argument) ? array_keys($this->argument) : array();
|
||||
$argument_keys = isset($this->argument) ? array_keys($this->argument) : [];
|
||||
$id = current($argument_keys);
|
||||
|
||||
/** @var \Drupal\Core\Url $url */
|
||||
|
@ -2085,7 +2084,7 @@ class ViewExecutable implements \Serializable {
|
|||
* errors.
|
||||
*/
|
||||
public function validate() {
|
||||
$errors = array();
|
||||
$errors = [];
|
||||
|
||||
$this->initDisplay();
|
||||
$current_display = $this->current_display;
|
||||
|
@ -2159,7 +2158,7 @@ class ViewExecutable implements \Serializable {
|
|||
* @return string
|
||||
* The unique ID for this handler instance.
|
||||
*/
|
||||
public function addHandler($display_id, $type, $table, $field, $options = array(), $id = NULL) {
|
||||
public function addHandler($display_id, $type, $table, $field, $options = [], $id = NULL) {
|
||||
$types = $this::getHandlerTypes();
|
||||
$this->setDisplay($display_id);
|
||||
|
||||
|
@ -2173,11 +2172,11 @@ class ViewExecutable implements \Serializable {
|
|||
// If the desired type is not found, use the original value directly.
|
||||
$handler_type = !empty($types[$type]['type']) ? $types[$type]['type'] : $type;
|
||||
|
||||
$fields[$id] = array(
|
||||
$fields[$id] = [
|
||||
'id' => $id,
|
||||
'table' => $table,
|
||||
'field' => $field,
|
||||
) + $options;
|
||||
] + $options;
|
||||
|
||||
if (isset($data['table']['entity type'])) {
|
||||
$fields[$id]['entity_type'] = $data['table']['entity type'];
|
||||
|
@ -2406,7 +2405,7 @@ class ViewExecutable implements \Serializable {
|
|||
* An array of theme hook suggestions.
|
||||
*/
|
||||
public function buildThemeFunctions($hook) {
|
||||
$themes = array();
|
||||
$themes = [];
|
||||
$display = isset($this->display_handler) ? $this->display_handler->display : NULL;
|
||||
$id = $this->storage->id();
|
||||
|
||||
|
|
Reference in a new issue