From 2daec13e0b29096ec85bad259b3e07637a1c65ca Mon Sep 17 00:00:00 2001 From: "tim.plunkett" <tim.plunkett@241634.no-reply.drupal.org> Date: Sun, 23 Sep 2012 21:09:23 +0200 Subject: [PATCH] Issue #1792454 by tim.plunkett: Add type hinting to function signatures for $view. --- includes/admin.inc | 20 +++++++-------- lib/Drupal/views/Plugin/views/HandlerBase.php | 2 +- .../Plugin/views/access/AccessPluginBase.php | 3 ++- .../Plugin/views/area/AreaPluginBase.php | 3 ++- .../views/Plugin/views/argument/ManyToOne.php | 3 ++- .../views/Plugin/views/argument/String.php | 3 ++- .../ArgumentDefaultPluginBase.php | 3 ++- .../ArgumentValidatorPluginBase.php | 3 ++- .../Plugin/views/cache/CachePluginBase.php | 3 ++- .../DisplayExtenderPluginBase.php | 3 ++- .../exposed_form/ExposedFormPluginBase.php | 3 ++- .../views/Plugin/views/field/Boolean.php | 4 ++- .../views/Plugin/views/field/Markup.php | 3 ++- .../views/Plugin/views/filter/Broken.php | 3 ++- .../Plugin/views/filter/FilterPluginBase.php | 3 ++- .../views/Plugin/views/filter/ManyToOne.php | 3 ++- lib/Drupal/views/Plugin/views/pager/None.php | 3 ++- .../Plugin/views/pager/PagerPluginBase.php | 3 ++- .../Plugin/views/query/QueryPluginBase.php | 9 ++++--- lib/Drupal/views/Plugin/views/query/Sql.php | 9 ++++--- .../views/relationship/GroupwiseMax.php | 1 - .../relationship/RelationshipPluginBase.php | 3 ++- .../views/Plugin/views/row/RowPluginBase.php | 3 ++- .../Plugin/views/sort/GroupByNumeric.php | 3 ++- .../Plugin/views/style/StylePluginBase.php | 3 ++- .../comment/Plugin/views/field/Comment.php | 3 ++- .../comment/Plugin/views/field/Username.php | 3 ++- .../field/Plugin/views/argument/FieldList.php | 3 ++- .../Plugin/views/argument/ListString.php | 3 ++- lib/Views/field/Plugin/views/field/Field.php | 3 ++- .../views/relationship/EntityReverse.php | 3 ++- lib/Views/file/Plugin/views/field/File.php | 3 ++- .../views/field/HistoryUserTimestamp.php | 3 ++- lib/Views/node/Plugin/views/field/Node.php | 3 ++- .../node/Plugin/views/field/Revision.php | 3 ++- lib/Views/node/Plugin/views/row/View.php | 3 ++- .../Plugin/views/field/AccesslogPath.php | 3 ++- .../Plugin/views/argument_default/Tid.php | 3 ++- .../Plugin/views/argument_validator/Term.php | 3 ++- .../Plugin/views/field/TaxonomyIndexTid.php | 3 ++- .../Plugin/views/filter/TaxonomyIndexTid.php | 3 ++- .../views/relationship/NodeTermData.php | 3 ++- lib/Views/user/Plugin/views/field/Name.php | 3 ++- lib/Views/user/Plugin/views/field/User.php | 3 ++- tests/views_test_data/views_test_data.module | 4 +-- theme/theme.inc | 3 ++- views.module | 25 ++++--------------- views_ui.module | 2 +- 48 files changed, 110 insertions(+), 83 deletions(-) diff --git a/includes/admin.inc b/includes/admin.inc index d81b87a863be..528eac8d67ad 100644 --- a/includes/admin.inc +++ b/includes/admin.inc @@ -793,7 +793,7 @@ function theme_views_ui_view_info($variables) { /** * Page to delete a view. */ -function views_ui_break_lock_confirm($form, &$form_state, $view) { +function views_ui_break_lock_confirm($form, &$form_state, ViewExecutable $view) { $form_state['view'] = &$view; $form = array(); @@ -912,7 +912,7 @@ function views_ui_build_preview($view, $display_id, $render = TRUE) { * * @see views_ui_ajax_get_form() */ -function views_ui_edit_form($form, &$form_state, $view, $display_id = NULL) { +function views_ui_edit_form($form, &$form_state, ViewExecutable $view, $display_id = NULL) { // Do not allow the form to be cached, because $form_state['view'] can become // stale between page requests. // See views_ui_ajax_get_form() for how this affects #ajax. @@ -1097,7 +1097,7 @@ function views_ui_edit_form($form, &$form_state, $view, $display_id = NULL) { /** * Provide the preview formulas and the preview output, too. */ -function views_ui_preview_form($form, &$form_state, $view, $display_id = 'default') { +function views_ui_preview_form($form, &$form_state, ViewExecutable $view, $display_id = 'default') { $form_state['no_cache'] = TRUE; $form_state['view'] = $view; @@ -1672,7 +1672,7 @@ function views_ui_get_display_tab_details($view, $display) { * This function might be more logical as a method on an object, if a suitable * object emerges out of refactoring. */ -function views_ui_edit_form_get_build_from_option($id, $option, $view, $display) { +function views_ui_edit_form_get_build_from_option($id, $option, ViewExecutable $view, $display) { $option_build = array(); $option_build['#theme'] = 'views_ui_display_tab_setting'; @@ -2100,7 +2100,7 @@ function views_ui_edit_view_form_delete($form, &$form_state) { /** * Add information about a section to a display. */ -function views_ui_edit_form_get_bucket($type, $view, $display) { +function views_ui_edit_form_get_bucket($type, ViewExecutable $view, $display) { $build = array( '#theme_wrappers' => array('views_ui_display_tab_bucket'), ); @@ -2285,7 +2285,7 @@ function views_ui_edit_form_get_bucket($type, $view, $display) { /** * Regenerate the current tab for AJAX updates. */ -function views_ui_regenerate_tab(&$view, &$output, $display_id) { +function views_ui_regenerate_tab(ViewExecutable $view, &$output, $display_id) { if (!$view->setDisplay('default')) { return; } @@ -2674,7 +2674,7 @@ function views_ui_ajax_forms($key = NULL) { * is the same as another. Since the arguments differ slightly * we do a lot of spiffy concatenation here. */ -function views_ui_build_identifier($key, $view, $display_id, $args) { +function views_ui_build_identifier($key, ViewExecutable $view, $display_id, $args) { $form = views_ui_ajax_forms($key); // Automatically remove the single-form cache if it exists and // does not match the key. @@ -2691,7 +2691,7 @@ function views_ui_build_identifier($key, $view, $display_id, $args) { * Build up a $form_state object suitable for use with drupal_build_form * based on known information about a form. */ -function views_ui_build_form_state($js, $key, &$view, $display_id, $args) { +function views_ui_build_form_state($js, $key, ViewExecutable $view, $display_id, $args) { $form = views_ui_ajax_forms($key); // Build up form state $form_state = array( @@ -2729,7 +2729,7 @@ function views_ui_build_form_url($form_state) { * Add another form to the stack; clicking 'apply' will go to this form * rather than closing the ajax popup. */ -function views_ui_add_form_to_stack($key, &$view, $display_id, $args, $top = FALSE, $rebuild_keys = FALSE) { +function views_ui_add_form_to_stack($key, ViewExecutable $view, $display_id, $args, $top = FALSE, $rebuild_keys = FALSE) { if (empty($view->stack)) { $view->stack = array(); } @@ -2773,7 +2773,7 @@ function views_ui_add_form_to_stack($key, &$view, $display_id, $args, $top = FAL * We do this for consistency and to make it easy to chain forms * together. */ -function views_ui_ajax_form($js, $key, $view, $display_id = '') { +function views_ui_ajax_form($js, $key, ViewExecutable $view, $display_id = '') { $form = views_ui_ajax_forms($key); if (empty($form)) { return MENU_NOT_FOUND; diff --git a/lib/Drupal/views/Plugin/views/HandlerBase.php b/lib/Drupal/views/Plugin/views/HandlerBase.php index 907b8396f8cb..b61de0627b67 100644 --- a/lib/Drupal/views/Plugin/views/HandlerBase.php +++ b/lib/Drupal/views/Plugin/views/HandlerBase.php @@ -87,7 +87,7 @@ public function __construct(array $configuration, $plugin_id, DiscoveryInterface * The item from the database; the actual contents of this will vary * based upon the type of handler. */ - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { $this->setOptionDefaults($this->options, $this->defineOptions()); $this->view = &$view; $display_id = $this->view->current_display; diff --git a/lib/Drupal/views/Plugin/views/access/AccessPluginBase.php b/lib/Drupal/views/Plugin/views/access/AccessPluginBase.php index 31a92fb8fe91..738d7123c680 100644 --- a/lib/Drupal/views/Plugin/views/access/AccessPluginBase.php +++ b/lib/Drupal/views/Plugin/views/access/AccessPluginBase.php @@ -8,6 +8,7 @@ namespace Drupal\views\Plugin\views\access; use Drupal\views\Plugin\views\PluginBase; +use Drupal\views\ViewExecutable; /** * @defgroup views_access_plugins Views access plugins @@ -33,7 +34,7 @@ abstract class AccessPluginBase extends PluginBase { * @param $display * The display handler. */ - public function init(&$view, &$display) { + public function init(ViewExecutable $view, &$display) { $this->setOptionDefaults($this->options, $this->defineOptions()); $this->view = &$view; $this->displayHandler = &$display; diff --git a/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php b/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php index 94caeb366baf..db0383ed25f2 100644 --- a/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php +++ b/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php @@ -7,6 +7,7 @@ namespace Drupal\views\Plugin\views\area; +use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\PluginBase; use Drupal\views\Plugin\views\HandlerBase; @@ -30,7 +31,7 @@ abstract class AreaPluginBase extends HandlerBase { * Make sure that no result area handlers are set to be shown when the result * is empty. */ - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { $this->setOptionDefaults($this->options, $this->defineOptions()); parent::init($view, $options); if ($this->definition['plugin_type'] == 'empty') { diff --git a/lib/Drupal/views/Plugin/views/argument/ManyToOne.php b/lib/Drupal/views/Plugin/views/argument/ManyToOne.php index fe0073fe3e29..9ca51001731e 100644 --- a/lib/Drupal/views/Plugin/views/argument/ManyToOne.php +++ b/lib/Drupal/views/Plugin/views/argument/ManyToOne.php @@ -7,6 +7,7 @@ namespace Drupal\views\Plugin\views\argument; +use Drupal\views\ViewExecutable; use Drupal\Core\Annotation\Plugin; use Drupal\views\ManyToOneHelper; @@ -29,7 +30,7 @@ */ class ManyToOne extends ArgumentPluginBase { - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { parent::init($view, $options); $this->helper = new ManyToOneHelper($this); diff --git a/lib/Drupal/views/Plugin/views/argument/String.php b/lib/Drupal/views/Plugin/views/argument/String.php index 27be1ca6086f..2f3646a5bf13 100644 --- a/lib/Drupal/views/Plugin/views/argument/String.php +++ b/lib/Drupal/views/Plugin/views/argument/String.php @@ -7,6 +7,7 @@ namespace Drupal\views\Plugin\views\argument; +use Drupal\views\ViewExecutable; use Drupal\views\ManyToOneHelper; use Drupal\Core\Annotation\Plugin; @@ -22,7 +23,7 @@ */ class String extends ArgumentPluginBase { - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { parent::init($view, $options); if (!empty($this->definition['many to one'])) { $this->helper = new ManyToOneHelper($this); diff --git a/lib/Drupal/views/Plugin/views/argument_default/ArgumentDefaultPluginBase.php b/lib/Drupal/views/Plugin/views/argument_default/ArgumentDefaultPluginBase.php index e0cf9fecccdf..5465f0e4383f 100644 --- a/lib/Drupal/views/Plugin/views/argument_default/ArgumentDefaultPluginBase.php +++ b/lib/Drupal/views/Plugin/views/argument_default/ArgumentDefaultPluginBase.php @@ -7,6 +7,7 @@ namespace Drupal\views\Plugin\views\argument_default; +use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\PluginBase; /** @@ -33,7 +34,7 @@ function get_argument() { } * Initialize this plugin with the view and the argument * it is linked to. */ - public function init(&$view, &$argument, $options) { + public function init(ViewExecutable $view, &$argument, $options) { $this->setOptionDefaults($this->options, $this->defineOptions()); $this->view = &$view; $this->argument = &$argument; diff --git a/lib/Drupal/views/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php b/lib/Drupal/views/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php index 3a9aa4a8d60e..c14be5f59714 100644 --- a/lib/Drupal/views/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php +++ b/lib/Drupal/views/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php @@ -7,6 +7,7 @@ namespace Drupal\views\Plugin\views\argument_validator; +use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\PluginBase; /** @@ -26,7 +27,7 @@ abstract class ArgumentValidatorPluginBase extends PluginBase { * Initialize this plugin with the view and the argument * it is linked to. */ - public function init(&$view, &$argument, $options) { + public function init(ViewExecutable $view, &$argument, $options) { $this->setOptionDefaults($this->options, $this->defineOptions()); $this->view = &$view; $this->argument = &$argument; diff --git a/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php b/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php index 9f45b7c55c75..1d2e4fc6b4f2 100644 --- a/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php +++ b/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php @@ -7,6 +7,7 @@ namespace Drupal\views\Plugin\views\cache; +use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\PluginBase; use Drupal\Core\Database\Query\Select; @@ -62,7 +63,7 @@ abstract class CachePluginBase extends PluginBase { * @param $display * The display handler. */ - public function init(&$view, &$display) { + public function init(ViewExecutable $view, &$display) { $this->setOptionDefaults($this->options, $this->defineOptions()); $this->view = &$view; $this->displayHandler = &$display; diff --git a/lib/Drupal/views/Plugin/views/display_extender/DisplayExtenderPluginBase.php b/lib/Drupal/views/Plugin/views/display_extender/DisplayExtenderPluginBase.php index bc64f129ef1e..e7fe061a67dc 100644 --- a/lib/Drupal/views/Plugin/views/display_extender/DisplayExtenderPluginBase.php +++ b/lib/Drupal/views/Plugin/views/display_extender/DisplayExtenderPluginBase.php @@ -7,6 +7,7 @@ namespace Drupal\views\Plugin\views\display_extender; +use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\PluginBase; use Drupal\Core\Annotation\Translation; @@ -17,7 +18,7 @@ */ abstract class DisplayExtenderPluginBase extends PluginBase { - public function init(&$view, &$display) { + public function init(ViewExecutable $view, &$display) { $this->setOptionDefaults($this->options, $this->defineOptions()); $this->view = $view; $this->display = $display; diff --git a/lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php b/lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php index 1bafe9eae863..cb71597e1752 100644 --- a/lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php +++ b/lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php @@ -7,6 +7,7 @@ namespace Drupal\views\Plugin\views\exposed_form; +use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\PluginBase; /** @@ -37,7 +38,7 @@ abstract class ExposedFormPluginBase extends PluginBase { * @param $display * The display handler. */ - public function init(&$view, &$display, $options = array()) { + public function init(ViewExecutable $view, &$display, $options = array()) { $this->setOptionDefaults($this->options, $this->defineOptions()); $this->view = &$view; $this->displayHandler = &$display; diff --git a/lib/Drupal/views/Plugin/views/field/Boolean.php b/lib/Drupal/views/Plugin/views/field/Boolean.php index 4fbab84c8483..5a9ae65a0b4f 100644 --- a/lib/Drupal/views/Plugin/views/field/Boolean.php +++ b/lib/Drupal/views/Plugin/views/field/Boolean.php @@ -6,6 +6,8 @@ */ namespace Drupal\views\Plugin\views\field; + +use Drupal\views\ViewExecutable; use Drupal\Core\Annotation\Plugin; /** @@ -38,7 +40,7 @@ protected function defineOptions() { return $options; } - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { parent::init($view, $options); $default_formats = array( diff --git a/lib/Drupal/views/Plugin/views/field/Markup.php b/lib/Drupal/views/Plugin/views/field/Markup.php index 8e961fc397a7..d82a5291e5ec 100644 --- a/lib/Drupal/views/Plugin/views/field/Markup.php +++ b/lib/Drupal/views/Plugin/views/field/Markup.php @@ -8,6 +8,7 @@ namespace Drupal\views\Plugin\views\field; use Drupal\Core\Annotation\Plugin; +use Drupal\views\ViewExecutable; /** * A handler to run a field through check_markup, using a companion @@ -26,7 +27,7 @@ */ class Markup extends FieldPluginBase { - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { parent::init($view, $options); $this->format = $this->definition['format']; diff --git a/lib/Drupal/views/Plugin/views/filter/Broken.php b/lib/Drupal/views/Plugin/views/filter/Broken.php index b7085155995f..02eb9a5d77e0 100644 --- a/lib/Drupal/views/Plugin/views/filter/Broken.php +++ b/lib/Drupal/views/Plugin/views/filter/Broken.php @@ -8,6 +8,7 @@ namespace Drupal\views\Plugin\views\filter; use Drupal\Core\Annotation\Plugin; +use Drupal\views\ViewExecutable; /** * A special handler to take the place of missing or broken handlers. @@ -24,7 +25,7 @@ public function adminLabel($short = FALSE) { return t('Broken/missing handler'); } - public function init(&$view, &$options) { } + public function init(ViewExecutable $view, &$options) { } public function defineOptions() { return array(); } public function ensureMyTable() { /* No table to ensure! */ } public function query($group_by = FALSE) { /* No query to run */ } diff --git a/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php b/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php index aba949a9c8e5..aa3b8d8a43b9 100644 --- a/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php +++ b/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php @@ -9,6 +9,7 @@ use Drupal\views\Plugin\views\HandlerBase; use Drupal\Core\Annotation\Plugin; +use Drupal\views\ViewExecutable; /** * @defgroup views_filter_handlers Views filter handlers @@ -78,7 +79,7 @@ abstract class FilterPluginBase extends HandlerBase { * This likely has to be overridden by filters which are more complex * than simple operator/value. */ - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { parent::init($view, $options); $this->operator = $this->options['operator']; diff --git a/lib/Drupal/views/Plugin/views/filter/ManyToOne.php b/lib/Drupal/views/Plugin/views/filter/ManyToOne.php index 4e2e3bf82ea4..d3ff72cbdf88 100644 --- a/lib/Drupal/views/Plugin/views/filter/ManyToOne.php +++ b/lib/Drupal/views/Plugin/views/filter/ManyToOne.php @@ -7,6 +7,7 @@ namespace Drupal\views\Plugin\views\filter; +use Drupal\views\ViewExecutable; use Drupal\views\ManyToOneHelper; use Drupal\Core\Annotation\Plugin; @@ -33,7 +34,7 @@ class ManyToOne extends InOperator { */ var $helper = NULL; - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { parent::init($view, $options); $this->helper = new ManyToOneHelper($this); } diff --git a/lib/Drupal/views/Plugin/views/pager/None.php b/lib/Drupal/views/Plugin/views/pager/None.php index 434f0c16ad3b..7d6ec89e5b18 100644 --- a/lib/Drupal/views/Plugin/views/pager/None.php +++ b/lib/Drupal/views/Plugin/views/pager/None.php @@ -7,6 +7,7 @@ namespace Drupal\views\Plugin\views\pager; +use Drupal\views\ViewExecutable; use Drupal\Core\Annotation\Plugin; use Drupal\Core\Annotation\Translation; @@ -24,7 +25,7 @@ */ class None extends PagerPluginBase { - public function init(&$view, &$display, $options = array()) { + public function init(ViewExecutable $view, &$display, $options = array()) { parent::init($view, $display, $options); // If the pager is set to none, then it should show all items. diff --git a/lib/Drupal/views/Plugin/views/pager/PagerPluginBase.php b/lib/Drupal/views/Plugin/views/pager/PagerPluginBase.php index 1500934a5a8f..11b8724c7676 100644 --- a/lib/Drupal/views/Plugin/views/pager/PagerPluginBase.php +++ b/lib/Drupal/views/Plugin/views/pager/PagerPluginBase.php @@ -8,6 +8,7 @@ namespace Drupal\views\Plugin\views\pager; use Drupal\views\Plugin\views\PluginBase; +use Drupal\views\ViewExecutable; /** * @defgroup views_pager_plugins Views pager plugins @@ -42,7 +43,7 @@ abstract class PagerPluginBase extends PluginBase { * @param $display * The display handler. */ - public function init(&$view, &$display, $options = array()) { + public function init(ViewExecutable $view, &$display, $options = array()) { $this->setOptionDefaults($this->options, $this->defineOptions()); $this->view = &$view; $this->displayHandler = &$display; diff --git a/lib/Drupal/views/Plugin/views/query/QueryPluginBase.php b/lib/Drupal/views/Plugin/views/query/QueryPluginBase.php index 4faae115d66a..502ebdc56932 100644 --- a/lib/Drupal/views/Plugin/views/query/QueryPluginBase.php +++ b/lib/Drupal/views/Plugin/views/query/QueryPluginBase.php @@ -8,6 +8,7 @@ namespace Drupal\views\Plugin\views\query; use Drupal\views\Plugin\views\PluginBase; +use Drupal\views\ViewExecutable; /** * @todo. @@ -46,7 +47,7 @@ public function query($get_count = FALSE) { } * @param view $view * The view which is executed. */ - function alter(&$view) { } + function alter(ViewExecutable $view) { } /** * Builds the necessary info to execute the query. @@ -54,7 +55,7 @@ function alter(&$view) { } * @param view $view * The view which is executed. */ - function build(&$view) { } + function build(ViewExecutable $view) { } /** * Executes the query and fills the associated view object with according @@ -69,7 +70,7 @@ function build(&$view) { } * @param view $view * The view which is executed. */ - function execute(&$view) { } + function execute(ViewExecutable $view) { } /** * Add a signature to the query, if such a thing is feasible. @@ -80,7 +81,7 @@ function execute(&$view) { } * @param view $view * The view which is executed. */ - function add_signature(&$view) { } + function add_signature(ViewExecutable $view) { } /** * Get aggregation info for group by queries. diff --git a/lib/Drupal/views/Plugin/views/query/Sql.php b/lib/Drupal/views/Plugin/views/query/Sql.php index 894553c7c05c..b94074c7094e 100644 --- a/lib/Drupal/views/Plugin/views/query/Sql.php +++ b/lib/Drupal/views/Plugin/views/query/Sql.php @@ -12,6 +12,7 @@ use Drupal\views\Plugin\views\join\JoinPluginBase; use Drupal\Core\Annotation\Plugin; use Drupal\Core\Annotation\Translation; +use Drupal\views\ViewExecutable; /** * @todo. @@ -1402,7 +1403,7 @@ function get_where_args() { /** * Let modules modify the query just prior to finalizing it. */ - function alter(&$view) { + function alter(ViewExecutable $view) { foreach (module_implements('views_query_alter') as $module) { $function = $module . '_views_query_alter'; $function($view, $this); @@ -1412,7 +1413,7 @@ function alter(&$view) { /** * Builds the necessary info to execute the query. */ - function build(&$view) { + function build(ViewExecutable $view) { // Make the query distinct if the option was set. if (!empty($this->options['distinct'])) { $this->set_distinct(TRUE); @@ -1437,7 +1438,7 @@ function build(&$view) { * Values to set: $view->result, $view->total_rows, $view->execute_time, * $view->current_page. */ - function execute(&$view) { + function execute(ViewExecutable $view) { $external = FALSE; // Whether this query will run against an external database. $query = $view->build_info['query']; $count_query = $view->build_info['count_query']; @@ -1646,7 +1647,7 @@ function load_entities(&$results) { } } - function add_signature(&$view) { + function add_signature(ViewExecutable $view) { $view->query->add_field(NULL, "'" . $view->storage->name . ':' . $view->current_display . "'", 'view_name'); } diff --git a/lib/Drupal/views/Plugin/views/relationship/GroupwiseMax.php b/lib/Drupal/views/Plugin/views/relationship/GroupwiseMax.php index b570523c76ab..54125ed71c3f 100644 --- a/lib/Drupal/views/Plugin/views/relationship/GroupwiseMax.php +++ b/lib/Drupal/views/Plugin/views/relationship/GroupwiseMax.php @@ -8,7 +8,6 @@ namespace Drupal\views\Plugin\views\relationship; use Drupal\Core\Database\Query\AlterableInterface; -use Drupal\views\ViewExecutable; use Drupal\Core\Annotation\Plugin; /** diff --git a/lib/Drupal/views/Plugin/views/relationship/RelationshipPluginBase.php b/lib/Drupal/views/Plugin/views/relationship/RelationshipPluginBase.php index 7d9abd540dac..e879dac92e76 100644 --- a/lib/Drupal/views/Plugin/views/relationship/RelationshipPluginBase.php +++ b/lib/Drupal/views/Plugin/views/relationship/RelationshipPluginBase.php @@ -7,6 +7,7 @@ namespace Drupal\views\Plugin\views\relationship; +use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\HandlerBase; use Drupal\views\Join; use Drupal\Core\Annotation\Plugin; @@ -47,7 +48,7 @@ abstract class RelationshipPluginBase extends HandlerBase { * Init handler to let relationships live on tables other than * the table they operate on. */ - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { $this->setOptionDefaults($this->options, $this->defineOptions()); parent::init($view, $options); if (isset($this->definition['relationship table'])) { diff --git a/lib/Drupal/views/Plugin/views/row/RowPluginBase.php b/lib/Drupal/views/Plugin/views/row/RowPluginBase.php index b91079e6bf9f..2e6348e8acfc 100644 --- a/lib/Drupal/views/Plugin/views/row/RowPluginBase.php +++ b/lib/Drupal/views/Plugin/views/row/RowPluginBase.php @@ -8,6 +8,7 @@ namespace Drupal\views\Plugin\views\row; use Drupal\views\Plugin\views\PluginBase; +use Drupal\views\ViewExecutable; /** * @defgroup views_row_plugins Views row plugins @@ -41,7 +42,7 @@ abstract class RowPluginBase extends PluginBase { /** * Initialize the row plugin. */ - public function init(&$view, &$display, $options = NULL) { + public function init(ViewExecutable $view, &$display, $options = NULL) { $this->setOptionDefaults($this->options, $this->defineOptions()); $this->view = &$view; $this->displayHandler = &$display; diff --git a/lib/Drupal/views/Plugin/views/sort/GroupByNumeric.php b/lib/Drupal/views/Plugin/views/sort/GroupByNumeric.php index 437d8c4dddf5..e52bc06eff96 100644 --- a/lib/Drupal/views/Plugin/views/sort/GroupByNumeric.php +++ b/lib/Drupal/views/Plugin/views/sort/GroupByNumeric.php @@ -8,6 +8,7 @@ namespace Drupal\views\Plugin\views\sort; use Drupal\Core\Annotation\Plugin; +use Drupal\views\ViewExecutable; /** * Handler for GROUP BY on simple numeric fields. @@ -18,7 +19,7 @@ */ class GroupByNumeric extends SortPluginBase { - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { parent::init($view, $options); // Initialize the original handler. diff --git a/lib/Drupal/views/Plugin/views/style/StylePluginBase.php b/lib/Drupal/views/Plugin/views/style/StylePluginBase.php index 6f2bee647b96..4bcc5a08b534 100644 --- a/lib/Drupal/views/Plugin/views/style/StylePluginBase.php +++ b/lib/Drupal/views/Plugin/views/style/StylePluginBase.php @@ -11,6 +11,7 @@ use Drupal\views\Plugin\views\wizard\WizardInterface; use Drupal\Core\Annotation\Plugin; use Drupal\Core\Annotation\Translation; +use Drupal\views\ViewExecutable; /** * @defgroup views_style_plugins Views style plugins @@ -89,7 +90,7 @@ abstract class StylePluginBase extends PluginBase { * The style options might come externally as the style can be sourced * from at least two locations. If it's not included, look on the display. */ - public function init(&$view, &$display, $options = NULL) { + public function init(ViewExecutable $view, &$display, $options = NULL) { $this->setOptionDefaults($this->options, $this->defineOptions()); $this->view = &$view; $this->displayHandler = &$display; diff --git a/lib/Views/comment/Plugin/views/field/Comment.php b/lib/Views/comment/Plugin/views/field/Comment.php index dd6afde1a4b2..fe151ad46288 100644 --- a/lib/Views/comment/Plugin/views/field/Comment.php +++ b/lib/Views/comment/Plugin/views/field/Comment.php @@ -7,6 +7,7 @@ namespace Views\comment\Plugin\views\field; +use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\field\FieldPluginBase; use Drupal\Core\Annotation\Plugin; @@ -25,7 +26,7 @@ class Comment extends FieldPluginBase { /** * Override init function to provide generic option to link to comment. */ - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { parent::init($view, $options); if (!empty($this->options['link_to_comment'])) { $this->additional_fields['cid'] = 'cid'; diff --git a/lib/Views/comment/Plugin/views/field/Username.php b/lib/Views/comment/Plugin/views/field/Username.php index 025d4be58a9b..52e8851a006f 100644 --- a/lib/Views/comment/Plugin/views/field/Username.php +++ b/lib/Views/comment/Plugin/views/field/Username.php @@ -7,6 +7,7 @@ namespace Views\comment\Plugin\views\field; +use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\field\FieldPluginBase; use Drupal\Core\Annotation\Plugin; @@ -25,7 +26,7 @@ class Username extends FieldPluginBase { /** * Override init function to add uid and homepage fields. */ - public function init(&$view, &$data) { + public function init(ViewExecutable $view, &$data) { parent::init($view, $data); $this->additional_fields['uid'] = 'uid'; $this->additional_fields['homepage'] = 'homepage'; diff --git a/lib/Views/field/Plugin/views/argument/FieldList.php b/lib/Views/field/Plugin/views/argument/FieldList.php index 8dc99c37f37d..f3b486b824c3 100644 --- a/lib/Views/field/Plugin/views/argument/FieldList.php +++ b/lib/Views/field/Plugin/views/argument/FieldList.php @@ -7,6 +7,7 @@ namespace Views\field\Plugin\views\argument; +use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\argument\Numeric; use Drupal\Core\Annotation\Plugin; @@ -30,7 +31,7 @@ class FieldList extends Numeric { */ var $allowed_values = NULL; - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { parent::init($view, $options); $field = field_info_field($this->definition['field_name']); $this->allowed_values = options_allowed_values($field); diff --git a/lib/Views/field/Plugin/views/argument/ListString.php b/lib/Views/field/Plugin/views/argument/ListString.php index a50af5a33c3d..6ac3f8d5c579 100644 --- a/lib/Views/field/Plugin/views/argument/ListString.php +++ b/lib/Views/field/Plugin/views/argument/ListString.php @@ -7,6 +7,7 @@ namespace Views\field\Plugin\views\argument; +use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\argument\String; use Drupal\Core\Annotation\Plugin; @@ -30,7 +31,7 @@ class ListString extends String { */ var $allowed_values = NULL; - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { parent::init($view, $options); $field = field_info_field($this->definition['field_name']); $this->allowed_values = options_allowed_values($field); diff --git a/lib/Views/field/Plugin/views/field/Field.php b/lib/Views/field/Plugin/views/field/Field.php index 21307c36c510..4a3561d11745 100644 --- a/lib/Views/field/Plugin/views/field/Field.php +++ b/lib/Views/field/Plugin/views/field/Field.php @@ -7,6 +7,7 @@ namespace Views\field\Plugin\views\field; +use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\field\FieldPluginBase; use Drupal\Core\Annotation\Plugin; @@ -65,7 +66,7 @@ class Field extends FieldPluginBase { */ public $instance; - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { parent::init($view, $options); $this->field_info = $field = field_info_field($this->definition['field_name']); diff --git a/lib/Views/field/Plugin/views/relationship/EntityReverse.php b/lib/Views/field/Plugin/views/relationship/EntityReverse.php index 2dc97a7933e6..c15c78f68bf5 100644 --- a/lib/Views/field/Plugin/views/relationship/EntityReverse.php +++ b/lib/Views/field/Plugin/views/relationship/EntityReverse.php @@ -7,6 +7,7 @@ namespace Views\field\Plugin\views\relationship; +use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\relationship\RelationshipPluginBase; use Drupal\Core\Annotation\Plugin; @@ -22,7 +23,7 @@ */ class EntityReverse extends RelationshipPluginBase { - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { parent::init($view, $options); $this->field_info = field_info_field($this->definition['field_name']); diff --git a/lib/Views/file/Plugin/views/field/File.php b/lib/Views/file/Plugin/views/field/File.php index c4b6a8742d19..a10f88db9d8b 100644 --- a/lib/Views/file/Plugin/views/field/File.php +++ b/lib/Views/file/Plugin/views/field/File.php @@ -7,6 +7,7 @@ namespace Views\file\Plugin\views\field; +use Drupal\views\ViewExecutable; use Drupal\Core\Annotation\Plugin; use Drupal\views\Plugin\views\field\FieldPluginBase; @@ -25,7 +26,7 @@ class File extends FieldPluginBase { /** * Constructor to provide additional field to add. */ - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { parent::init($view, $options); if (!empty($options['link_to_file'])) { $this->additional_fields['uri'] = 'uri'; diff --git a/lib/Views/node/Plugin/views/field/HistoryUserTimestamp.php b/lib/Views/node/Plugin/views/field/HistoryUserTimestamp.php index 74b63b7f3879..c45d62be415d 100644 --- a/lib/Views/node/Plugin/views/field/HistoryUserTimestamp.php +++ b/lib/Views/node/Plugin/views/field/HistoryUserTimestamp.php @@ -7,6 +7,7 @@ namespace Views\node\Plugin\views\field; +use Drupal\views\ViewExecutable; use Views\node\Plugin\views\field\Node; use Drupal\Core\Annotation\Plugin; @@ -25,7 +26,7 @@ */ class HistoryUserTimestamp extends Node { - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { parent::init($view, $options); global $user; if ($user->uid) { diff --git a/lib/Views/node/Plugin/views/field/Node.php b/lib/Views/node/Plugin/views/field/Node.php index 2995cb687769..974c6be4d65f 100644 --- a/lib/Views/node/Plugin/views/field/Node.php +++ b/lib/Views/node/Plugin/views/field/Node.php @@ -7,6 +7,7 @@ namespace Views\node\Plugin\views\field; +use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\field\FieldPluginBase; use Drupal\Core\Annotation\Plugin; @@ -24,7 +25,7 @@ */ class Node extends FieldPluginBase { - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { parent::init($view, $options); // Don't add the additional fields to groupby if (!empty($this->options['link_to_node'])) { diff --git a/lib/Views/node/Plugin/views/field/Revision.php b/lib/Views/node/Plugin/views/field/Revision.php index aeb000c69e14..2e1b12a2a29c 100644 --- a/lib/Views/node/Plugin/views/field/Revision.php +++ b/lib/Views/node/Plugin/views/field/Revision.php @@ -7,6 +7,7 @@ namespace Views\node\Plugin\views\field; +use Drupal\views\ViewExecutable; use Views\node\Plugin\views\field\Node; use Drupal\Core\Annotation\Plugin; @@ -22,7 +23,7 @@ */ class Revision extends Node { - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { parent::init($view, $options); if (!empty($this->options['link_to_node_revision'])) { $this->additional_fields['vid'] = 'vid'; diff --git a/lib/Views/node/Plugin/views/row/View.php b/lib/Views/node/Plugin/views/row/View.php index e49fb85a655b..2a081d4e0aea 100644 --- a/lib/Views/node/Plugin/views/row/View.php +++ b/lib/Views/node/Plugin/views/row/View.php @@ -7,6 +7,7 @@ namespace Views\node\Plugin\views\row; +use Drupal\views\ViewExecutable; use Drupal\Core\Annotation\Plugin; use Drupal\Core\Annotation\Translation; use Drupal\views\Plugin\views\row\RowPluginBase; @@ -37,7 +38,7 @@ class View extends RowPluginBase { // Stores the nodes loaded with pre_render. var $nodes = array(); - public function init(&$view, &$display, $options = NULL) { + public function init(ViewExecutable $view, &$display, $options = NULL) { parent::init($view, $display, $options); // Handle existing views with the deprecated 'teaser' option. if (isset($this->options['teaser'])) { diff --git a/lib/Views/statistics/Plugin/views/field/AccesslogPath.php b/lib/Views/statistics/Plugin/views/field/AccesslogPath.php index 6bdb3475a46e..4b16e204cbb7 100644 --- a/lib/Views/statistics/Plugin/views/field/AccesslogPath.php +++ b/lib/Views/statistics/Plugin/views/field/AccesslogPath.php @@ -7,6 +7,7 @@ namespace Views\statistics\Plugin\views\field; +use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\field\FieldPluginBase; use Drupal\Core\Annotation\Plugin; @@ -25,7 +26,7 @@ class AccesslogPath extends FieldPluginBase { /** * Override init function to provide generic option to link to node. */ - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { parent::init($view, $options); if (!empty($this->options['display_as_link'])) { $this->additional_fields['path'] = 'path'; diff --git a/lib/Views/taxonomy/Plugin/views/argument_default/Tid.php b/lib/Views/taxonomy/Plugin/views/argument_default/Tid.php index 9086e66cce79..583a0303e332 100644 --- a/lib/Views/taxonomy/Plugin/views/argument_default/Tid.php +++ b/lib/Views/taxonomy/Plugin/views/argument_default/Tid.php @@ -7,6 +7,7 @@ namespace Views\taxonomy\Plugin\views\argument_default; +use Drupal\views\ViewExecutable; use Drupal\Core\Annotation\Plugin; use Drupal\Core\Annotation\Translation; use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase; @@ -22,7 +23,7 @@ */ class Tid extends ArgumentDefaultPluginBase { - public function init(&$view, &$argument, $options) { + public function init(ViewExecutable $view, &$argument, $options) { parent::init($view, $argument, $options); // Convert legacy vids option to machine name vocabularies. diff --git a/lib/Views/taxonomy/Plugin/views/argument_validator/Term.php b/lib/Views/taxonomy/Plugin/views/argument_validator/Term.php index 16c1b80cefa9..73f567f3678c 100644 --- a/lib/Views/taxonomy/Plugin/views/argument_validator/Term.php +++ b/lib/Views/taxonomy/Plugin/views/argument_validator/Term.php @@ -7,6 +7,7 @@ namespace Views\taxonomy\Plugin\views\argument_validator; +use Drupal\views\ViewExecutable; use Drupal\Core\Annotation\Plugin; use Drupal\Core\Annotation\Translation; use Drupal\views\Plugin\views\argument_validator\ArgumentValidatorPluginBase; @@ -22,7 +23,7 @@ */ class Term extends ArgumentValidatorPluginBase { - public function init(&$view, &$argument, $options) { + public function init(ViewExecutable $view, &$argument, $options) { parent::init($view, $argument, $options); // Convert legacy vids option to machine name vocabularies. diff --git a/lib/Views/taxonomy/Plugin/views/field/TaxonomyIndexTid.php b/lib/Views/taxonomy/Plugin/views/field/TaxonomyIndexTid.php index 6deeb3470e67..c4ec9146cc42 100644 --- a/lib/Views/taxonomy/Plugin/views/field/TaxonomyIndexTid.php +++ b/lib/Views/taxonomy/Plugin/views/field/TaxonomyIndexTid.php @@ -7,6 +7,7 @@ namespace Views\taxonomy\Plugin\views\field; +use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\field\PrerenderList; use Drupal\Core\Annotation\Plugin; @@ -22,7 +23,7 @@ */ class TaxonomyIndexTid extends PrerenderList { - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { parent::init($view, $options); // @todo: Wouldn't it be possible to use $this->base_table and no if here? if ($view->base_table == 'node_revision') { diff --git a/lib/Views/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php b/lib/Views/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php index 1e11a3beeef7..f4300b082561 100644 --- a/lib/Views/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php +++ b/lib/Views/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php @@ -7,6 +7,7 @@ namespace Views\taxonomy\Plugin\views\filter; +use Drupal\views\ViewExecutable; use Drupal\Core\Annotation\Plugin; use Drupal\views\Plugin\views\filter\ManyToOne; @@ -25,7 +26,7 @@ class TaxonomyIndexTid extends ManyToOne { // Stores the exposed input for this filter. var $validated_exposed_input = NULL; - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { parent::init($view, $options); if (!empty($this->definition['vocabulary'])) { $this->options['vocabulary'] = $this->definition['vocabulary']; diff --git a/lib/Views/taxonomy/Plugin/views/relationship/NodeTermData.php b/lib/Views/taxonomy/Plugin/views/relationship/NodeTermData.php index a00a331271e8..f2bbd9a58f23 100644 --- a/lib/Views/taxonomy/Plugin/views/relationship/NodeTermData.php +++ b/lib/Views/taxonomy/Plugin/views/relationship/NodeTermData.php @@ -7,6 +7,7 @@ namespace Views\taxonomy\Plugin\views\relationship; +use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\relationship\RelationshipPluginBase; use Drupal\Core\Annotation\Plugin; @@ -22,7 +23,7 @@ */ class NodeTermData extends RelationshipPluginBase { - public function init(&$view, &$options) { + public function init(ViewExecutable $view, &$options) { parent::init($view, $options); // Convert legacy vids option to machine name vocabularies. diff --git a/lib/Views/user/Plugin/views/field/Name.php b/lib/Views/user/Plugin/views/field/Name.php index 3c76de4f2d95..8ce583d0111b 100644 --- a/lib/Views/user/Plugin/views/field/Name.php +++ b/lib/Views/user/Plugin/views/field/Name.php @@ -9,6 +9,7 @@ use Views\user\Plugin\views\field\User; use Drupal\Core\Annotation\Plugin; +use Drupal\views\ViewExecutable; /** * Field handler to provide simple renderer that allows using a themed user link. @@ -25,7 +26,7 @@ class Name extends User { /** * Add uid in the query so we can test for anonymous if needed. */ - public function init(&$view, &$data) { + public function init(ViewExecutable $view, &$data) { parent::init($view, $data); if (!empty($this->options['overwrite_anonymous']) || !empty($this->options['format_username'])) { $this->additional_fields['uid'] = 'uid'; diff --git a/lib/Views/user/Plugin/views/field/User.php b/lib/Views/user/Plugin/views/field/User.php index 641d773c7226..1fee9d2fd608 100644 --- a/lib/Views/user/Plugin/views/field/User.php +++ b/lib/Views/user/Plugin/views/field/User.php @@ -9,6 +9,7 @@ use Drupal\views\Plugin\views\field\FieldPluginBase; use Drupal\Core\Annotation\Plugin; +use Drupal\views\ViewExecutable; /** * Field handler to provide simple renderer that allows linking to a user. @@ -25,7 +26,7 @@ class User extends FieldPluginBase { /** * Override init function to provide generic option to link to user. */ - public function init(&$view, &$data) { + public function init(ViewExecutable $view, &$data) { parent::init($view, $data); if (!empty($this->options['link_to_user'])) { $this->additional_fields['uid'] = 'uid'; diff --git a/tests/views_test_data/views_test_data.module b/tests/views_test_data/views_test_data.module index 9f94f9a09de0..1341f46fce07 100644 --- a/tests/views_test_data/views_test_data.module +++ b/tests/views_test_data/views_test_data.module @@ -47,7 +47,7 @@ function views_test_data_test_dynamic_access_callback($access, $argument1, $argu /** * Implements hook_views_pre_render(). */ -function views_test_data_views_pre_render(&$view) { +function views_test_data_views_pre_render(ViewExecutable $view) { if ($view->storage->name == 'test_cache_header_storage') { drupal_add_js(drupal_get_path('module', 'views_test_data') . '/views_cache.test.js'); drupal_add_css(drupal_get_path('module', 'views_test_data') . '/views_cache.test.css'); @@ -58,7 +58,7 @@ function views_test_data_views_pre_render(&$view) { /** * Implements hook_views_post_build(). */ -function views_test_data_views_post_build(ViewExecutable &$view) { +function views_test_data_views_post_build(ViewExecutable $view) { if ($view->storage->name == 'test_page_display') { if ($view->current_display == 'page_1') { $view->build_info['denied'] = TRUE; diff --git a/theme/theme.inc b/theme/theme.inc index 41644ae6389a..9a4a227b0a8c 100644 --- a/theme/theme.inc +++ b/theme/theme.inc @@ -6,6 +6,7 @@ */ use Drupal\Core\Template\Attribute; +use Drupal\views\ViewExecutable; /** * Provide a full array of possible themes to try for a given hook. @@ -17,7 +18,7 @@ * @param $display * The display being rendered, if applicable. */ -function _views_theme_functions($hook, $view, $display = NULL) { +function _views_theme_functions($hook, ViewExecutable $view, $display = NULL) { $themes = array(); if ($display) { diff --git a/views.module b/views.module index e1823740e13b..bbe7d81bc90b 100644 --- a/views.module +++ b/views.module @@ -12,7 +12,6 @@ use Drupal\Core\Database\Query\AlterableInterface; use Drupal\views\ViewExecutable; use Drupal\views\TempStore\UserTempStore; -use Drupal\views\ViewStorage; use Drupal\Component\Plugin\Exception\PluginException; /** @@ -817,7 +816,7 @@ function views_block_view($delta) { * The type of the block. If it's block it's a regular views display, * but 'special_block_-exp' exist as well. */ -function views_add_block_contextual_links(&$block, $view, $display_id, $block_type = 'block') { +function views_add_block_contextual_links(&$block, ViewExecutable $view, $display_id, $block_type = 'block') { // Do not add contextual links to an empty block. if (!empty($block['content'])) { // Contextual links only work on blocks whose content is a renderable @@ -895,7 +894,7 @@ function views_add_block_contextual_links(&$block, $view, $display_id, $block_ty * @see views_page_alter() * @see template_preprocess_views_view() */ -function views_add_contextual_links(&$render_element, $location, $view, $display_id) { +function views_add_contextual_links(&$render_element, $location, ViewExecutable $view, $display_id) { // Do not do anything if the view is configured to hide its administrative // links. if (empty($view->hide_admin_links)) { @@ -1741,20 +1740,6 @@ function views_move_table($table) { return $table; } -/** - * Export CRUD callback to save a view. - */ -function views_save_view(&$view) { - return $view->save(); -} - -/** - * Export CRUD callback to delete a view. - */ -function views_delete_view(&$view) { - return $view->delete(TRUE); -} - // ------------------------------------------------------------------ // Views form (View with form elements) @@ -1784,7 +1769,7 @@ function views_view_has_form_elements($view) { * step (the default 'views_form_views_form' step). That way it is actually * possible for modules to have a multistep form if they need to. */ -function views_form($form, &$form_state, $view, $output) { +function views_form($form, &$form_state, ViewExecutable $view, $output) { $form_state['step'] = isset($form_state['step']) ? $form_state['step'] : 'views_form_views_form'; // Cache the built form to prevent it from being rebuilt prior to validation // and submission, which could lead to data being processed incorrectly, @@ -1809,7 +1794,7 @@ function views_form($form, &$form_state, $view, $output) { * Callback for the main step of a Views form. * Invoked by views_form(). */ -function views_form_views_form($form, &$form_state, $view, $output) { +function views_form_views_form($form, &$form_state, ViewExecutable $view, $output) { $form['#prefix'] = '<div class="views-form">'; $form['#suffix'] = '</div>'; $form['#theme'] = 'views_form_views_form'; @@ -2111,7 +2096,7 @@ function views_exposed_form_cache($views_name, $display_name, $form_output = NUL /** * Build a list of theme function names for use most everywhere. */ -function views_theme_functions($hook, $view, $display = NULL) { +function views_theme_functions($hook, ViewExecutable $view, $display = NULL) { module_load_include('inc', 'views', 'theme/theme'); return _views_theme_functions($hook, $view, $display); } diff --git a/views_ui.module b/views_ui.module index 3db82fc7d355..4a39f33fd4d4 100644 --- a/views_ui.module +++ b/views_ui.module @@ -325,7 +325,7 @@ function views_ui_cache_load($name) { * Specialized cache function to add a flag to our view, include an appropriate * include, and cache more easily. */ -function views_ui_cache_set(&$view) { +function views_ui_cache_set(ViewExecutable $view) { if (!empty($view->locked)) { drupal_set_message(t('Changes cannot be made to a locked view.'), 'error'); return; -- GitLab