summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwebchick2012-12-22 05:11:43 (GMT)
committerwebchick2012-12-22 05:11:43 (GMT)
commitdc6c7a4be92f183cba1c5d44ffb4610f210939ee (patch)
treee5570ffa2b2dd070eb2b9b030bef11d8c4662558
parent532ea17f07178d5fba60cde2e6ecd1e49b33428f (diff)
Issue #1850792 by damiankloip, dawehner, tim.plunkett: Make init() method consistent across all views plugins.
-rw-r--r--core/modules/comment/lib/Drupal/comment/Plugin/views/field/Comment.php10
-rw-r--r--core/modules/comment/lib/Drupal/comment/Plugin/views/field/LastTimestamp.php5
-rw-r--r--core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeNewComments.php5
-rw-r--r--core/modules/comment/lib/Drupal/comment/Plugin/views/field/Username.php10
-rw-r--r--core/modules/field/lib/Drupal/field/Plugin/views/argument/FieldList.php9
-rw-r--r--core/modules/field/lib/Drupal/field/Plugin/views/argument/ListString.php9
-rw-r--r--core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php8
-rw-r--r--core/modules/field/lib/Drupal/field/Plugin/views/relationship/EntityReverse.php8
-rw-r--r--core/modules/file/lib/Drupal/file/Plugin/views/field/File.php8
-rw-r--r--core/modules/node/lib/Drupal/node/Plugin/views/field/HistoryUserTimestamp.php9
-rw-r--r--core/modules/node/lib/Drupal/node/Plugin/views/field/Node.php9
-rw-r--r--core/modules/node/lib/Drupal/node/Plugin/views/field/Path.php7
-rw-r--r--core/modules/node/lib/Drupal/node/Plugin/views/field/Revision.php9
-rw-r--r--core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLink.php5
-rw-r--r--core/modules/system/lib/Drupal/system/Plugin/views/row/EntityRow.php7
-rw-r--r--core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_default/Tid.php19
-rw-r--r--core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_validator/Term.php19
-rw-r--r--core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/LinkEdit.php5
-rw-r--r--core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/Taxonomy.php5
-rw-r--r--core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/TaxonomyIndexTid.php9
-rw-r--r--core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php9
-rw-r--r--core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/relationship/NodeTermData.php19
-rw-r--r--core/modules/user/lib/Drupal/user/Plugin/views/field/Link.php5
-rw-r--r--core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php8
-rw-r--r--core/modules/user/lib/Drupal/user/Plugin/views/field/Permissions.php5
-rw-r--r--core/modules/user/lib/Drupal/user/Plugin/views/field/Roles.php5
-rw-r--r--core/modules/user/lib/Drupal/user/Plugin/views/field/User.php8
-rw-r--r--core/modules/user/lib/Drupal/user/Plugin/views/filter/Current.php5
-rw-r--r--core/modules/views/lib/Drupal/views/DisplayArray.php2
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php15
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php20
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/access/AccessPluginBase.php16
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php6
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/argument/ArgumentPluginBase.php19
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/argument/Formula.php5
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/argument/ManyToOne.php9
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/argument/String.php9
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/argument_default/ArgumentDefaultPluginBase.php22
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php20
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php16
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php8
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/display/Feed.php7
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/display_extender/DisplayExtenderPluginBase.php6
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php17
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/field/Boolean.php8
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php5
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/field/Markup.php8
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/filter/BooleanOperator.php7
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/filter/Broken.php8
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php7
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/filter/InOperator.php7
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/filter/ManyToOne.php9
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/pager/None.php6
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/pager/PagerPluginBase.php16
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/query/QueryPluginBase.php11
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php5
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/relationship/RelationshipPluginBase.php9
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/row/RowPluginBase.php12
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/sort/GroupByNumeric.php10
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/style/StylePluginBase.php18
-rw-r--r--core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTest.php2
-rw-r--r--core/modules/views/lib/Drupal/views/ViewExecutable.php2
-rw-r--r--core/modules/views/views_ui/admin.inc15
63 files changed, 350 insertions, 251 deletions
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Comment.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Comment.php
index eadc0b5..20b3c59 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Comment.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Comment.php
@@ -8,6 +8,7 @@
namespace Drupal\comment\Plugin\views\field;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\Core\Annotation\Plugin;
@@ -24,10 +25,13 @@ use Drupal\Core\Annotation\Plugin;
class Comment extends FieldPluginBase {
/**
- * Override init function to provide generic option to link to comment.
+ * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::init().
+ *
+ * Provide generic option to link to comment.
*/
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
+
if (!empty($this->options['link_to_comment'])) {
$this->additional_fields['cid'] = 'cid';
$this->additional_fields['nid'] = 'nid';
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LastTimestamp.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LastTimestamp.php
index 1f14803..9cc34a4 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LastTimestamp.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LastTimestamp.php
@@ -8,6 +8,7 @@
namespace Drupal\comment\Plugin\views\field;
use Drupal\views\Plugin\views\field\Date;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\Core\Annotation\Plugin;
@@ -26,8 +27,8 @@ class LastTimestamp extends Date {
/**
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
$this->additional_fields['comment_count'] = 'comment_count';
}
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeNewComments.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeNewComments.php
index fe24f52..b46b138 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeNewComments.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeNewComments.php
@@ -8,6 +8,7 @@
namespace Drupal\comment\Plugin\views\field;
use Drupal\views\Plugin\views\field\Numeric;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\Core\Annotation\Plugin;
@@ -26,8 +27,8 @@ class NodeNewComments extends Numeric {
/**
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
$this->additional_fields['nid'] = 'nid';
$this->additional_fields['type'] = 'type';
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Username.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Username.php
index 42a7590..05e7338 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Username.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Username.php
@@ -8,6 +8,7 @@
namespace Drupal\comment\Plugin\views\field;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\Core\Annotation\Plugin;
@@ -24,10 +25,13 @@ use Drupal\Core\Annotation\Plugin;
class Username extends FieldPluginBase {
/**
- * Override init function to add uid and homepage fields.
+ * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::init().
+ *
+ * Add uid and homepage fields.
*/
- public function init(ViewExecutable $view, &$data) {
- parent::init($view, $data);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
+
$this->additional_fields['uid'] = 'uid';
$this->additional_fields['homepage'] = 'homepage';
}
diff --git a/core/modules/field/lib/Drupal/field/Plugin/views/argument/FieldList.php b/core/modules/field/lib/Drupal/field/Plugin/views/argument/FieldList.php
index f1b0d35..cd1e221 100644
--- a/core/modules/field/lib/Drupal/field/Plugin/views/argument/FieldList.php
+++ b/core/modules/field/lib/Drupal/field/Plugin/views/argument/FieldList.php
@@ -8,6 +8,7 @@
namespace Drupal\field\Plugin\views\argument;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\argument\Numeric;
use Drupal\Core\Annotation\Plugin;
@@ -31,8 +32,12 @@ class FieldList extends Numeric {
*/
var $allowed_values = NULL;
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ /**
+ * Overrides \Drupal\views\Plugin\views\argument\ArgumentPluginBase::init().
+ */
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
+
$field = field_info_field($this->definition['field_name']);
$this->allowed_values = options_allowed_values($field);
}
diff --git a/core/modules/field/lib/Drupal/field/Plugin/views/argument/ListString.php b/core/modules/field/lib/Drupal/field/Plugin/views/argument/ListString.php
index 596d73e..4bceac3 100644
--- a/core/modules/field/lib/Drupal/field/Plugin/views/argument/ListString.php
+++ b/core/modules/field/lib/Drupal/field/Plugin/views/argument/ListString.php
@@ -8,6 +8,7 @@
namespace Drupal\field\Plugin\views\argument;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\argument\String;
use Drupal\Core\Annotation\Plugin;
@@ -31,8 +32,12 @@ class ListString extends String {
*/
var $allowed_values = NULL;
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ /**
+ * Overrides \Drupal\views\Plugin\views\argument\String::init().
+ */
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
+
$field = field_info_field($this->definition['field_name']);
$this->allowed_values = options_allowed_values($field);
}
diff --git a/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php
index 4c56bff..e3150e3 100644
--- a/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php
+++ b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php
@@ -8,6 +8,7 @@
namespace Drupal\field\Plugin\views\field;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\Core\Annotation\Plugin;
@@ -66,8 +67,11 @@ class Field extends FieldPluginBase {
*/
public $instance;
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ /**
+ * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::init().
+ */
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
$this->field_info = $field = field_info_field($this->definition['field_name']);
$this->multiple = FALSE;
diff --git a/core/modules/field/lib/Drupal/field/Plugin/views/relationship/EntityReverse.php b/core/modules/field/lib/Drupal/field/Plugin/views/relationship/EntityReverse.php
index 75ad533..bc9abf3 100644
--- a/core/modules/field/lib/Drupal/field/Plugin/views/relationship/EntityReverse.php
+++ b/core/modules/field/lib/Drupal/field/Plugin/views/relationship/EntityReverse.php
@@ -8,6 +8,7 @@
namespace Drupal\field\Plugin\views\relationship;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\relationship\RelationshipPluginBase;
use Drupal\Core\Annotation\Plugin;
@@ -23,8 +24,11 @@ use Drupal\Core\Annotation\Plugin;
*/
class EntityReverse extends RelationshipPluginBase {
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ /**
+ * Overrides \Drupal\views\Plugin\views\relationship\RelationshipPluginBase::init().
+ */
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
$this->field_info = field_info_field($this->definition['field_name']);
}
diff --git a/core/modules/file/lib/Drupal/file/Plugin/views/field/File.php b/core/modules/file/lib/Drupal/file/Plugin/views/field/File.php
index facf8a5..7c1f06f 100644
--- a/core/modules/file/lib/Drupal/file/Plugin/views/field/File.php
+++ b/core/modules/file/lib/Drupal/file/Plugin/views/field/File.php
@@ -8,6 +8,7 @@
namespace Drupal\file\Plugin\views\field;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\Core\Annotation\Plugin;
use Drupal\views\Plugin\views\field\FieldPluginBase;
@@ -24,10 +25,11 @@ use Drupal\views\Plugin\views\field\FieldPluginBase;
class File extends FieldPluginBase {
/**
- * Constructor to provide additional field to add.
+ * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
+
if (!empty($options['link_to_file'])) {
$this->additional_fields['uri'] = 'uri';
}
diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/field/HistoryUserTimestamp.php b/core/modules/node/lib/Drupal/node/Plugin/views/field/HistoryUserTimestamp.php
index 3617bc6..2e00f1c 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/views/field/HistoryUserTimestamp.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/views/field/HistoryUserTimestamp.php
@@ -8,6 +8,7 @@
namespace Drupal\node\Plugin\views\field;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\node\Plugin\views\field\Node;
use Drupal\Core\Annotation\Plugin;
@@ -26,8 +27,12 @@ use Drupal\Core\Annotation\Plugin;
*/
class HistoryUserTimestamp extends Node {
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ /**
+ * Overrides \Drupal\node\Plugin\views\field\Node::init().
+ */
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
+
global $user;
if ($user->uid) {
$this->additional_fields['created'] = array('table' => 'node', 'field' => 'created');
diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/field/Node.php b/core/modules/node/lib/Drupal/node/Plugin/views/field/Node.php
index b78e9f0..f2044dc 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/views/field/Node.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/views/field/Node.php
@@ -8,6 +8,7 @@
namespace Drupal\node\Plugin\views\field;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\Core\Annotation\Plugin;
@@ -25,8 +26,12 @@ use Drupal\Core\Annotation\Plugin;
*/
class Node extends FieldPluginBase {
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ /**
+ * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::init().
+ */
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
+
// Don't add the additional fields to groupby
if (!empty($this->options['link_to_node'])) {
$this->additional_fields['nid'] = array('table' => 'node', 'field' => 'nid');
diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/field/Path.php b/core/modules/node/lib/Drupal/node/Plugin/views/field/Path.php
index 1fca3d3..9c3e186 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/views/field/Path.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/views/field/Path.php
@@ -8,6 +8,7 @@
namespace Drupal\node\Plugin\views\field;
use Drupal\views\Plugin\views\field\FieldPluginBase;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\Core\Annotation\Plugin;
@@ -24,10 +25,10 @@ use Drupal\Core\Annotation\Plugin;
class Path extends FieldPluginBase {
/**
- * Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
+ * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
$this->additional_fields['nid'] = 'nid';
}
diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/field/Revision.php b/core/modules/node/lib/Drupal/node/Plugin/views/field/Revision.php
index 163c9f3..d3b24cc 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/views/field/Revision.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/views/field/Revision.php
@@ -8,6 +8,7 @@
namespace Drupal\node\Plugin\views\field;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\node\Plugin\views\field\Node;
use Drupal\Core\Annotation\Plugin;
@@ -23,8 +24,12 @@ use Drupal\Core\Annotation\Plugin;
*/
class Revision extends Node {
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ /**
+ * Overrides \Drupal\node\Plugin\views\field\Node::init().
+ */
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
+
if (!empty($this->options['link_to_node_revision'])) {
$this->additional_fields['vid'] = 'vid';
$this->additional_fields['nid'] = 'nid';
diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLink.php b/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLink.php
index 0701234..aa50d43 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLink.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLink.php
@@ -8,6 +8,7 @@
namespace Drupal\node\Plugin\views\field;
use Drupal\node\Plugin\views\field\Link;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\Core\Annotation\Plugin;
@@ -26,8 +27,8 @@ class RevisionLink extends Link {
/**
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
$this->additional_fields['node_vid'] = array('table' => 'node_revision', 'field' => 'vid');
}
diff --git a/core/modules/system/lib/Drupal/system/Plugin/views/row/EntityRow.php b/core/modules/system/lib/Drupal/system/Plugin/views/row/EntityRow.php
index 886ffa4..bb13b25 100644
--- a/core/modules/system/lib/Drupal/system/Plugin/views/row/EntityRow.php
+++ b/core/modules/system/lib/Drupal/system/Plugin/views/row/EntityRow.php
@@ -8,6 +8,7 @@
namespace Drupal\system\Plugin\views\row;
use Drupal\views\Plugin\views\row\RowPluginBase;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
/**
@@ -51,12 +52,12 @@ class EntityRow extends RowPluginBase {
protected $build = array();
/**
- * Overrides Drupal\views\Plugin\views\row\RowPluginBase::init().
+ * Overrides Drupal\views\Plugin\views\PluginBase::init().
*/
- public function init(ViewExecutable $view, &$display, $options = NULL) {
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);
- $this->entityType = $this->definition['entity_type'];
+ $this->entityType = $this->definition['entity_type'];
$this->entityInfo = entity_get_info($this->entityType);
$this->base_table = $this->entityInfo['base_table'];
$this->base_field = $this->entityInfo['entity_keys']['id'];
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_default/Tid.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_default/Tid.php
index 19a7691..b09ed5a 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_default/Tid.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_default/Tid.php
@@ -8,6 +8,7 @@
namespace Drupal\taxonomy\Plugin\views\argument_default;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\Core\Annotation\Plugin;
use Drupal\Core\Annotation\Translation;
use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase;
@@ -23,8 +24,22 @@ use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase;
*/
class Tid extends ArgumentDefaultPluginBase {
- public function init(ViewExecutable $view, &$argument, $options) {
- parent::init($view, $argument, $options);
+ /**
+ * Overrides \Drupal\views\Plugin\views\Plugin\views\PluginBase::init().
+ */
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
+
+ // @todo Remove the legacy code.
+ // Convert legacy vids option to machine name vocabularies.
+ if (!empty($this->options['vids'])) {
+ $vocabularies = taxonomy_vocabulary_get_names();
+ foreach ($this->options['vids'] as $vid) {
+ if (isset($vocabularies[$vid], $vocabularies[$vid]->machine_name)) {
+ $this->options['vocabularies'][$vocabularies[$vid]->machine_name] = $vocabularies[$vid]->machine_name;
+ }
+ }
+ }
}
protected function defineOptions() {
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_validator/Term.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_validator/Term.php
index 51d697d..484559a 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_validator/Term.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_validator/Term.php
@@ -8,6 +8,7 @@
namespace Drupal\taxonomy\Plugin\views\argument_validator;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\Core\Annotation\Plugin;
use Drupal\Core\Annotation\Translation;
use Drupal\views\Plugin\views\argument_validator\ArgumentValidatorPluginBase;
@@ -23,8 +24,22 @@ use Drupal\views\Plugin\views\argument_validator\ArgumentValidatorPluginBase;
*/
class Term extends ArgumentValidatorPluginBase {
- public function init(ViewExecutable $view, &$argument, $options) {
- parent::init($view, $argument, $options);
+ /**
+ * Overrides \Drupal\views\Plugin\views\Plugin\views\PluginBase::init().
+ */
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
+
+ // @todo Remove the legacy code.
+ // Convert legacy vids option to machine name vocabularies.
+ if (!empty($this->options['vids'])) {
+ $vocabularies = taxonomy_vocabulary_get_names();
+ foreach ($this->options['vids'] as $vid) {
+ if (isset($vocabularies[$vid], $vocabularies[$vid]->machine_name)) {
+ $this->options['vocabularies'][$vocabularies[$vid]->machine_name] = $vocabularies[$vid]->machine_name;
+ }
+ }
+ }
}
protected function defineOptions() {
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/LinkEdit.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/LinkEdit.php
index 8af32b3..1d990d1 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/LinkEdit.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/LinkEdit.php
@@ -8,6 +8,7 @@
namespace Drupal\taxonomy\Plugin\views\field;
use Drupal\views\Plugin\views\field\FieldPluginBase;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\Core\Annotation\Plugin;
@@ -26,8 +27,8 @@ class LinkEdit extends FieldPluginBase {
/**
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
$this->additional_fields['tid'] = 'tid';
$this->additional_fields['vid'] = 'vid';
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/Taxonomy.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/Taxonomy.php
index a098bfd..9f0e90d 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/Taxonomy.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/Taxonomy.php
@@ -8,6 +8,7 @@
namespace Drupal\taxonomy\Plugin\views\field;
use Drupal\views\Plugin\views\field\FieldPluginBase;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\Core\Annotation\Plugin;
@@ -32,8 +33,8 @@ class Taxonomy extends FieldPluginBase {
* This method assumes the taxonomy_term_data table. If using another table,
* we'll need to be more specific.
*/
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
$this->additional_fields['vid'] = 'vid';
$this->additional_fields['tid'] = 'tid';
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/TaxonomyIndexTid.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/TaxonomyIndexTid.php
index ba97f66..cc90a63 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/TaxonomyIndexTid.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/TaxonomyIndexTid.php
@@ -8,6 +8,7 @@
namespace Drupal\taxonomy\Plugin\views\field;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\field\PrerenderList;
use Drupal\Core\Annotation\Plugin;
@@ -23,8 +24,12 @@ use Drupal\Core\Annotation\Plugin;
*/
class TaxonomyIndexTid extends PrerenderList {
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ /**
+ * Overrides \Drupal\views\Plugin\views\field\PrerenderList::init().
+ */
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
+
// @todo: Wouldn't it be possible to use $this->base_table and no if here?
if ($view->storage->get('base_table') == 'node_revision') {
$this->additional_fields['nid'] = array('table' => 'node_revision', 'field' => 'nid');
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php
index 74a3ef4..968aece 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php
@@ -8,6 +8,7 @@
namespace Drupal\taxonomy\Plugin\views\filter;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\Core\Annotation\Plugin;
use Drupal\views\Plugin\views\filter\ManyToOne;
@@ -26,8 +27,12 @@ class TaxonomyIndexTid extends ManyToOne {
// Stores the exposed input for this filter.
var $validated_exposed_input = NULL;
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ /**
+ * Overrides \Drupal\views\Plugin\views\filter\ManyToOne::init().
+ */
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
+
if (!empty($this->definition['vocabulary'])) {
$this->options['vid'] = $this->definition['vocabulary'];
}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/relationship/NodeTermData.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/relationship/NodeTermData.php
index 6b06783..f5a929a 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/relationship/NodeTermData.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/relationship/NodeTermData.php
@@ -8,6 +8,7 @@
namespace Drupal\taxonomy\Plugin\views\relationship;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\relationship\RelationshipPluginBase;
use Drupal\Core\Annotation\Plugin;
@@ -23,8 +24,22 @@ use Drupal\Core\Annotation\Plugin;
*/
class NodeTermData extends RelationshipPluginBase {
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ /**
+ * Overrides \Drupal\views\Plugin\views\relationship\RelationshipPluginBase::init().
+ */
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
+
+ // @todo Remove the legacy code.
+ // Convert legacy vids option to machine name vocabularies.
+ if (!empty($this->options['vids'])) {
+ $vocabularies = taxonomy_vocabulary_get_names();
+ foreach ($this->options['vids'] as $vid) {
+ if (isset($vocabularies[$vid], $vocabularies[$vid]->machine_name)) {
+ $this->options['vocabularies'][$vocabularies[$vid]->machine_name] = $vocabularies[$vid]->machine_name;
+ }
+ }
+ }
}
protected function defineOptions() {
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/Link.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/Link.php
index 1dae1e2..8d354c2 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/field/Link.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/Link.php
@@ -8,6 +8,7 @@
namespace Drupal\user\Plugin\views\field;
use Drupal\views\Plugin\views\field\FieldPluginBase;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Annotation\Plugin;
@@ -27,8 +28,8 @@ class Link extends FieldPluginBase {
/**
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
$this->additional_fields['uid'] = 'uid';
}
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php
index 5b7a101..f3074fb 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php
@@ -8,6 +8,7 @@
namespace Drupal\user\Plugin\views\field;
use Drupal\user\Plugin\views\field\User;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\Core\Annotation\Plugin;
use Drupal\views\ViewExecutable;
@@ -24,10 +25,13 @@ use Drupal\views\ViewExecutable;
class Name extends User {
/**
+ * Overrides \Drupal\user\Plugin\views\field\User::init().
+ *
* Add uid in the query so we can test for anonymous if needed.
*/
- public function init(ViewExecutable $view, &$data) {
- parent::init($view, $data);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
+
if (!empty($this->options['overwrite_anonymous']) || !empty($this->options['format_username'])) {
$this->additional_fields['uid'] = 'uid';
}
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/Permissions.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/Permissions.php
index 98cb021..10f0c5e 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/field/Permissions.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/Permissions.php
@@ -8,6 +8,7 @@
namespace Drupal\user\Plugin\views\field;
use Drupal\Core\Annotation\Plugin;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\field\PrerenderList;
@@ -26,8 +27,8 @@ class Permissions extends PrerenderList {
/**
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
$this->additional_fields['uid'] = array('table' => 'users', 'field' => 'uid');
}
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/Roles.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/Roles.php
index 947175a..c4eb050 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/field/Roles.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/Roles.php
@@ -8,6 +8,7 @@
namespace Drupal\user\Plugin\views\field;
use Drupal\Core\Annotation\Plugin;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\field\PrerenderList;
@@ -26,8 +27,8 @@ class Roles extends PrerenderList {
/**
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
$this->additional_fields['uid'] = array('table' => 'users', 'field' => 'uid');
}
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/User.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/User.php
index 81721f1..c67f5e9 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/field/User.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/User.php
@@ -8,6 +8,7 @@
namespace Drupal\user\Plugin\views\field;
use Drupal\views\Plugin\views\field\FieldPluginBase;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\Core\Annotation\Plugin;
use Drupal\views\ViewExecutable;
@@ -24,10 +25,11 @@ use Drupal\views\ViewExecutable;
class User extends FieldPluginBase {
/**
- * Override init function to provide generic option to link to user.
+ * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
- public function init(ViewExecutable $view, &$data) {
- parent::init($view, $data);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
+
if (!empty($this->options['link_to_user'])) {
$this->additional_fields['uid'] = 'uid';
}
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/filter/Current.php b/core/modules/user/lib/Drupal/user/Plugin/views/filter/Current.php
index b24e658..43798f4 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/filter/Current.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/filter/Current.php
@@ -8,6 +8,7 @@
namespace Drupal\user\Plugin\views\filter;
use Drupal\Core\Annotation\Plugin;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\filter\BooleanOperator;
@@ -26,8 +27,8 @@ class Current extends BooleanOperator {
/**
* Overrides Drupal\views\Plugin\views\filter\BooleanOperator::init().
*/
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
$this->value_value = t('Is the logged in user');
}
diff --git a/core/modules/views/lib/Drupal/views/DisplayArray.php b/core/modules/views/lib/Drupal/views/DisplayArray.php
index 35be37e..41b48a2 100644
--- a/core/modules/views/lib/Drupal/views/DisplayArray.php
+++ b/core/modules/views/lib/Drupal/views/DisplayArray.php
@@ -80,7 +80,7 @@ class DisplayArray implements \ArrayAccess, \Iterator, \Countable {
$this->displayHandlers[$display_id] = drupal_container()->get("plugin.manager.views.display")->createInstance('default');
}
- $this->displayHandlers[$display_id]->init($this->view, $display);
+ $this->displayHandlers[$display_id]->initDisplay($this->view, $display);
// If this is not the default display handler, let it know which is since
// it may well utilize some data from the default.
if ($display_id != 'default') {
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php
index ef039c8..579e71d 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php
@@ -8,6 +8,7 @@
namespace Drupal\views\Plugin\views;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\PluginBase;
use Drupal\views\ViewExecutable;
use Drupal\Core\Database\Database;
@@ -80,17 +81,11 @@ abstract class HandlerBase extends PluginBase {
}
/**
- * Init the handler with necessary data.
- *
- * @param Drupal\views\ViewExecutable $view
- * The $view object this handler is attached to.
- * @param array $options
- * The item from the database; the actual contents of this will vary
- * based upon the type of handler.
+ * Overrides \Drupal\views\Plugin\views\PluginBase::init().
*/
- public function init(ViewExecutable $view, &$options) {
- $this->setOptionDefaults($this->options, $this->defineOptions());
- $this->view = &$view;
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
+
$display_id = $this->view->current_display;
// Check to see if this handler type is defaulted. Note that
// we have to do a lookup because the type is singular but the
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php
index 36b1a01..e6c2551 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php
@@ -8,7 +8,9 @@
namespace Drupal\views\Plugin\views;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\Component\Plugin\PluginBase as ComponentPluginBase;
+use Drupal\views\ViewExecutable;
abstract class PluginBase extends ComponentPluginBase {
@@ -62,6 +64,24 @@ abstract class PluginBase extends ComponentPluginBase {
}
/**
+ * Initialize the plugin.
+ *
+ * @param \Drupal\views\ViewExecutable $view
+ * The view object.
+ * @param \Drupal\views\Plugin\views\display\DisplayPluginBase $display
+ * The display handler.
+ * @param array $options
+ * The options configured for this plugin.
+ */
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ $this->setOptionDefaults($this->options, $this->defineOptions());
+ $this->view = $view;
+ $this->displayHandler = $display;
+
+ $this->unpackOptions($this->options, $options);
+ }
+
+ /**
* Information about options for all kinds of purposes will be held here.
* @code
* 'option_name' => array(
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/access/AccessPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/access/AccessPluginBase.php
index 81ad219..0d70b4c 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/access/AccessPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/access/AccessPluginBase.php
@@ -25,22 +25,6 @@ use Drupal\views\ViewExecutable;
abstract class AccessPluginBase extends PluginBase {
/**
- * Initialize the plugin.
- *
- * @param $view
- * The view object.
- * @param $display
- * The display handler.
- */
- public function init(ViewExecutable $view, &$display, $options = NULL) {
- $this->setOptionDefaults($this->options, $this->defineOptions());
- $this->view = &$view;
- $this->displayHandler = &$display;
-
- $this->unpackOptions($this->options, $options);
- }
-
- /**
* Retrieve the options when this is a new access
* control plugin
*/
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php
index 37b92f2..8ce189a 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php
@@ -8,6 +8,7 @@
namespace Drupal\views\Plugin\views\area;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\PluginBase;
use Drupal\views\Plugin\views\HandlerBase;
@@ -31,9 +32,8 @@ 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(ViewExecutable $view, &$options) {
- $this->setOptionDefaults($this->options, $this->defineOptions());
- parent::init($view, $options);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
if (isset($this->handler_type) && ($this->handler_type == 'empty')) {
$this->options['empty'] = TRUE;
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/argument/ArgumentPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/argument/ArgumentPluginBase.php
index aaab76a..e3af73a 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/argument/ArgumentPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/argument/ArgumentPluginBase.php
@@ -8,6 +8,7 @@
namespace Drupal\views\Plugin\views\argument;
use Drupal\views\Plugin\views\PluginBase;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\HandlerBase;
@@ -64,8 +65,8 @@ abstract class ArgumentPluginBase extends HandlerBase {
/**
* Overrides Drupal\views\Plugin\views\HandlerBase:init().
*/
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
if (!empty($this->definition['name field'])) {
$this->name_field = $this->definition['name field'];
@@ -339,6 +340,7 @@ abstract class ArgumentPluginBase extends HandlerBase {
),
),
'#id' => 'edit-options-validate-options-' . $id,
+ '#default_value' => array(),
);
$plugin->buildOptionsForm($form['validate']['options'][$id], $form_state);
$validate_types[$id] = $info['title'];
@@ -544,6 +546,7 @@ abstract class ArgumentPluginBase extends HandlerBase {
':input[name="options[default_argument_type]"]' => array('value' => $id),
),
),
+ '#default_value' => array(),
);
$options[$id] = $info['title'];
$plugin->buildOptionsForm($form['argument_default'][$id], $form_state);
@@ -631,6 +634,7 @@ abstract class ArgumentPluginBase extends HandlerBase {
':input[name="options[summary][format]"]' => array('value' => $id),
),
),
+ '#default_value' => array(),
);
$options[$id] = $info['title'];
$plugin->buildOptionsForm($form['summary']['options'][$id], $form_state);
@@ -1055,12 +1059,11 @@ abstract class ArgumentPluginBase extends HandlerBase {
$plugin = drupal_container()->get("plugin.manager.views.$type")->createInstance($name);
if ($plugin) {
- // Style plugins expects different parameters as argument related plugins.
- if ($type == 'style') {
- $plugin->init($this->view, $this->view->display_handler->display, $options);
- }
- else {
- $plugin->init($this->view, $this, $options);
+ $plugin->init($this->view, $this->displayHandler, $options);
+
+ if ($type !== 'style') {
+ // It's an argument_default/argument_validate plugin, so set the argument.
+ $plugin->setArgument($this);
}
return $plugin;
}
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/argument/Formula.php b/core/modules/views/lib/Drupal/views/Plugin/views/argument/Formula.php
index 4c0865f..c82d206 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/argument/Formula.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/argument/Formula.php
@@ -8,6 +8,7 @@
namespace Drupal\views\Plugin\views\argument;
use Drupal\Core\Annotation\Plugin;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
/**
@@ -31,8 +32,8 @@ class Formula extends ArgumentPluginBase {
/**
* Overrides Drupal\views\Plugin\views\argument\ArgumentPluginBase::init().
*/
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
if (!empty($this->definition['formula'])) {
$this->formula = $this->definition['formula'];
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/argument/ManyToOne.php b/core/modules/views/lib/Drupal/views/Plugin/views/argument/ManyToOne.php
index b0807ad..141db80 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/argument/ManyToOne.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/argument/ManyToOne.php
@@ -8,6 +8,7 @@
namespace Drupal\views\Plugin\views\argument;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\Core\Annotation\Plugin;
use Drupal\views\ManyToOneHelper;
@@ -30,8 +31,12 @@ use Drupal\views\ManyToOneHelper;
*/
class ManyToOne extends ArgumentPluginBase {
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ /**
+ * Overrides \Drupal\views\Plugin\views\argument\ArgumentPluginBase::init().
+ */
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
+
$this->helper = new ManyToOneHelper($this);
// Ensure defaults for these, during summaries and stuff:
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/argument/String.php b/core/modules/views/lib/Drupal/views/Plugin/views/argument/String.php
index 59148de..f48dbdf 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/argument/String.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/argument/String.php
@@ -8,6 +8,7 @@
namespace Drupal\views\Plugin\views\argument;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ManyToOneHelper;
use Drupal\Core\Annotation\Plugin;
@@ -23,8 +24,12 @@ use Drupal\Core\Annotation\Plugin;
*/
class String extends ArgumentPluginBase {
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ /**
+ * Overrides \Drupal\views\Plugin\views\argument\ArgumentPluginBase::init().
+ */
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
+
if (!empty($this->definition['many to one'])) {
$this->helper = new ManyToOneHelper($this);
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/argument_default/ArgumentDefaultPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/argument_default/ArgumentDefaultPluginBase.php
index c957e30..3fd8d69 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/argument_default/ArgumentDefaultPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/argument_default/ArgumentDefaultPluginBase.php
@@ -8,6 +8,7 @@
namespace Drupal\views\Plugin\views\argument_default;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\argument\ArgumentPluginBase;
use Drupal\views\Plugin\views\PluginBase;
/**
@@ -22,6 +23,13 @@ use Drupal\views\Plugin\views\PluginBase;
abstract class ArgumentDefaultPluginBase extends PluginBase {
/**
+ * The argument handler instance associated with this plugin.
+ *
+ * @var \Drupal\views\Plugin\views\argument\ArgumentPluginBase
+ */
+ protected $argument;
+
+ /**
* Return the default argument.
*
* This needs to be overridden by every default argument handler to properly do what is needed.
@@ -29,15 +37,13 @@ abstract class ArgumentDefaultPluginBase extends PluginBase {
function get_argument() { }
/**
- * Initialize this plugin with the view and the argument
- * it is linked to.
+ * Sets the parent argument this plugin is associated with.
+ *
+ * @param \Drupal\views\Plugin\views\argument\ArgumentPluginBase $argument
+ * The parent argument to set.
*/
- public function init(ViewExecutable $view, &$argument, $options) {
- $this->setOptionDefaults($this->options, $this->defineOptions());
- $this->view = &$view;
- $this->argument = &$argument;
-
- $this->unpackOptions($this->options, $options);
+ public function setArgument(ArgumentPluginBase $argument) {
+ $this->argument = $argument;
}
/**
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php
index 9d9d92c..e481552 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php
@@ -8,6 +8,7 @@
namespace Drupal\views\Plugin\views\argument_validator;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\argument\ArgumentPluginBase;
use Drupal\views\Plugin\views\PluginBase;
/**
@@ -22,15 +23,20 @@ use Drupal\views\Plugin\views\PluginBase;
abstract class ArgumentValidatorPluginBase extends PluginBase {
/**
- * Initialize this plugin with the view and the argument
- * it is linked to.
+ * The argument handler instance associated with this plugin.
+ *
+ * @var \Drupal\views\Plugin\views\argument\ArgumentPluginBase
*/
- public function init(ViewExecutable $view, &$argument, $options) {
- $this->setOptionDefaults($this->options, $this->defineOptions());
- $this->view = &$view;
- $this->argument = &$argument;
+ protected $argument;
- $this->unpackOptions($this->options, $options);
+ /**
+ * Sets the parent argument this plugin is associated with.
+ *
+ * @param \Drupal\views\Plugin\views\argument\ArgumentPluginBase $argument
+ * The parent argument to set.
+ */
+ public function setArgument(ArgumentPluginBase $argument) {
+ $this->argument = $argument;
}
/**
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php
index 5b46ca0..ebae468 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php
@@ -58,22 +58,6 @@ abstract class CachePluginBase extends PluginBase {
protected $outputKey;
/**
- * Initialize the plugin.
- *
- * @param $view
- * The view object.
- * @param $display
- * The display handler.
- */
- public function init(ViewExecutable $view, &$display, $options = NULL) {
- $this->setOptionDefaults($this->options, $this->defineOptions());
- $this->view = &$view;
- $this->displayHandler = &$display;
-
- $this->unpackOptions($this->options, $options);
- }
-
- /**
* Returns the outputKey property.
*
* @return string
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
index bebee09..50a0eb7 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
@@ -96,9 +96,9 @@ abstract class DisplayPluginBase extends PluginBase {
*/
protected $usesAreas = TRUE;
- public function init(ViewExecutable $view, &$display, $options = NULL) {
+ public function initDisplay(ViewExecutable $view, array &$display, array &$options = NULL) {
$this->setOptionDefaults($this->options, $this->defineOptions());
- $this->view = &$view;
+ $this->view = $view;
$this->display = &$display;
// Load extenders as soon as possible.
@@ -882,7 +882,7 @@ abstract class DisplayPluginBase extends PluginBase {
$handler->handler_type = $type;
}
- $handler->init($this->view, $info);
+ $handler->init($this->view, $this, $info);
$this->handlers[$type][$id] = &$handler;
}
@@ -2308,7 +2308,7 @@ abstract class DisplayPluginBase extends PluginBase {
if ($plugin) {
// Because pagers have very similar options, let's allow pagers to
// try to carry the options over.
- $plugin->init($this->view, $this->display, $pager['options']);
+ $plugin->init($this->view, $this, $pager['options']);
$pager = array('type' => $form_state['values']['pager']['type'], 'options' => $plugin->options);
$this->setOption('pager', $pager);
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/Feed.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/Feed.php
index b2a0251..30a413c 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/display/Feed.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/Feed.php
@@ -42,8 +42,11 @@ class Feed extends PathPluginBase {
*/
protected $usesPager = FALSE;
- public function init(ViewExecutable $view, &$display, $options = NULL) {
- parent::init($view, $display, $options);
+ /**
+ * Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::initDisplay().
+ */
+ public function initDisplay(ViewExecutable $view, array &$display, array &$options = NULL) {
+ parent::initDisplay($view, $display, $options);
// Set the default row style. Ideally this would be part of the option
// definition, but in this case it's dependent on the view's base table,
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display_extender/DisplayExtenderPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/display_extender/DisplayExtenderPluginBase.php
index 0647022..02e030e 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/display_extender/DisplayExtenderPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/display_extender/DisplayExtenderPluginBase.php
@@ -18,12 +18,6 @@ use Drupal\Core\Annotation\Translation;
*/
abstract class DisplayExtenderPluginBase extends PluginBase {
- public function init(ViewExecutable $view, &$display) {
- $this->setOptionDefaults($this->options, $this->defineOptions());
- $this->view = $view;
- $this->displayHandler = $display;
- }
-
/**
* Provide a form to edit options for this plugin.
*/
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php
index 37df591..06bb4ea 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php
@@ -8,6 +8,7 @@
namespace Drupal\views\Plugin\views\exposed_form;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\PluginBase;
/**
@@ -28,22 +29,6 @@ abstract class ExposedFormPluginBase extends PluginBase {
*/
protected $usesOptions = TRUE;
- /**
- * Initialize the plugin.
- *
- * @param $view
- * The view object.
- * @param $display
- * The display handler.
- */
- public function init(ViewExecutable $view, &$display, $options = array()) {
- $this->setOptionDefaults($this->options, $this->defineOptions());
- $this->view = &$view;
- $this->displayHandler = &$display;
-
- $this->unpackOptions($this->options, $options);
- }
-
protected function defineOptions() {
$options = parent::defineOptions();
$options['submit_button'] = array('default' => 'Apply', 'translatable' => TRUE);
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/Boolean.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/Boolean.php
index 5a9ae65..c4f876d 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/field/Boolean.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/Boolean.php
@@ -8,6 +8,7 @@
namespace Drupal\views\Plugin\views\field;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\Core\Annotation\Plugin;
/**
@@ -40,8 +41,11 @@ class Boolean extends FieldPluginBase {
return $options;
}
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ /**
+ * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::init().
+ */
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
$default_formats = array(
'yes-no' => array(t('Yes'), t('No')),
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php
index 1073f04..33b9ba6 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php
@@ -8,6 +8,7 @@
namespace Drupal\views\Plugin\views\field;
use Drupal\views\Plugin\views\HandlerBase;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\Core\Annotation\Plugin;
@@ -70,8 +71,8 @@ abstract class FieldPluginBase extends HandlerBase {
/**
* Overrides Drupal\views\Plugin\views\HandlerBase::init().
*/
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
$this->additional_fields = array();
if (!empty($this->definition['additional fields'])) {
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/Markup.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/Markup.php
index d82a529..10b7126 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/field/Markup.php
+++ b/core/modules/views/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\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
/**
@@ -27,8 +28,11 @@ use Drupal\views\ViewExecutable;
*/
class Markup extends FieldPluginBase {
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ /**
+ * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::init().
+ */
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
$this->format = $this->definition['format'];
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/filter/BooleanOperator.php b/core/modules/views/lib/Drupal/views/Plugin/views/filter/BooleanOperator.php
index dcf6df3..28b8632 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/filter/BooleanOperator.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/filter/BooleanOperator.php
@@ -8,6 +8,7 @@
namespace Drupal\views\Plugin\views\filter;
use Drupal\Core\Annotation\Plugin;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
/**
@@ -40,10 +41,10 @@ class BooleanOperator extends FilterPluginBase {
var $accept_null = FALSE;
/**
- * Overrides Drupal\views\Plugin\views\filter\FilterPluginBase::init().
+ * Overrides \Drupal\views\Plugin\views\filter\FilterPluginBase::init().
*/
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
$this->value_value = t('True');
if (isset($this->definition['label'])) {
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/filter/Broken.php b/core/modules/views/lib/Drupal/views/Plugin/views/filter/Broken.php
index 02eb9a5..843aef4 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/filter/Broken.php
+++ b/core/modules/views/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\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
/**
@@ -21,11 +22,16 @@ use Drupal\views\ViewExecutable;
*/
class Broken extends FilterPluginBase {
+ /**
+ * Overrides \Drupal\views\Plugin\views\filter\FilterPluginBase::init().
+ */
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ }
+
public function adminLabel($short = FALSE) {
return t('Broken/missing handler');
}
- 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/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php
index 6b32ca3..c7771c0 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php
@@ -8,6 +8,7 @@
namespace Drupal\views\Plugin\views\filter;
use Drupal\views\Plugin\views\HandlerBase;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\Core\Annotation\Plugin;
use Drupal\views\ViewExecutable;
@@ -74,13 +75,15 @@ abstract class FilterPluginBase extends HandlerBase {
var $always_required = FALSE;
/**
+ * Overrides \Drupal\views\Plugin\views\HandlerBase::init().
+ *
* Provide some extra help to get the operator/value easier to use.
*
* This likely has to be overridden by filters which are more complex
* than simple operator/value.
*/
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
$this->operator = $this->options['operator'];
$this->value = $this->options['value'];
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/filter/InOperator.php b/core/modules/views/lib/Drupal/views/Plugin/views/filter/InOperator.php
index f3ae1d7..0f726cd 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/filter/InOperator.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/filter/InOperator.php
@@ -8,6 +8,7 @@
namespace Drupal\views\Plugin\views\filter;
use Drupal\Core\Annotation\Plugin;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
/**
@@ -34,10 +35,10 @@ class InOperator extends FilterPluginBase {
var $value_options = NULL;
/**
- * Overrides Drupal\views\Plugin\views\filter\FilterPluginBase::init().
+ * Overrides \Drupal\views\Plugin\views\filter\FilterPluginBase::init().
*/
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
$this->value_title = t('Options');
$this->value_options = NULL;
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/filter/ManyToOne.php b/core/modules/views/lib/Drupal/views/Plugin/views/filter/ManyToOne.php
index d3ff72c..53d43db 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/filter/ManyToOne.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/filter/ManyToOne.php
@@ -8,6 +8,7 @@
namespace Drupal\views\Plugin\views\filter;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ManyToOneHelper;
use Drupal\Core\Annotation\Plugin;
@@ -34,8 +35,12 @@ class ManyToOne extends InOperator {
*/
var $helper = NULL;
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ /**
+ * Overrides \Drupal\views\Plugin\views\filter\InOperator::init().
+ */
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
+
$this->helper = new ManyToOneHelper($this);
}
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/pager/None.php b/core/modules/views/lib/Drupal/views/Plugin/views/pager/None.php
index 7d6ec89..2d57c9f 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/pager/None.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/pager/None.php
@@ -8,6 +8,7 @@
namespace Drupal\views\Plugin\views\pager;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\Core\Annotation\Plugin;
use Drupal\Core\Annotation\Translation;
@@ -25,7 +26,10 @@ use Drupal\Core\Annotation\Translation;
*/
class None extends PagerPluginBase {
- public function init(ViewExecutable $view, &$display, $options = array()) {
+ /**
+ * Overrides \Drupal\views\Plugin\views\PluginBase::init().
+ */
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);
// If the pager is set to none, then it should show all items.
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/pager/PagerPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/pager/PagerPluginBase.php
index 82387b7..1c877ff 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/pager/PagerPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/pager/PagerPluginBase.php
@@ -34,22 +34,6 @@ abstract class PagerPluginBase extends PluginBase {
protected $usesOptions = TRUE;
/**
- * Initialize the plugin.
- *
- * @param $view
- * The view object.
- * @param $display
- * The display handler.
- */
- public function init(ViewExecutable $view, &$display, $options = array()) {
- $this->setOptionDefaults($this->options, $this->defineOptions());
- $this->view = &$view;
- $this->displayHandler = &$display;
-
- $this->unpackOptions($this->options, $options);
- }
-
- /**
* Get how many items per page this pager will display.
*
* All but the leanest pagers should probably return a value here, so
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/query/QueryPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/query/QueryPluginBase.php
index 10731b7..abe7ee4 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/query/QueryPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/query/QueryPluginBase.php
@@ -24,17 +24,6 @@ abstract class QueryPluginBase extends PluginBase implements QueryInterface {
var $pager = NULL;
/**
- * Overrides Drupal\views\Plugin\views\PluginBase::init().
- */
- public function init(ViewExecutable $view, DisplayPluginBase $display, array $options = array()) {
- $this->view = $view;
- $this->displayHandler = $display;
-
- $this->setOptionDefaults($this->options, $this->defineOptions());
- $this->unpackOptions($this->options, $options);
- }
-
- /**
* Generate a query and a countquery from all of the information supplied
* to the object.
*
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php b/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php
index c7bc967..8d0c585 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php
@@ -115,10 +115,11 @@ class Sql extends QueryPluginBase {
var $no_distinct;
/**
- * Overrides Drupal\views\Plugin\views\query\QueryPluginBase::init().
+ * Overrides \Drupal\views\Plugin\views\PluginBase::init().
*/
- public function init(ViewExecutable $view, DisplayPluginBase $display, array $options = array()) {
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);
+
$base_table = $this->view->storage->get('base_table');
$base_field = $this->view->storage->get('base_field');
$this->relationships[$base_table] = array(
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/relationship/RelationshipPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/relationship/RelationshipPluginBase.php
index f1641aa..47b16d4 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/relationship/RelationshipPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/relationship/RelationshipPluginBase.php
@@ -8,6 +8,7 @@
namespace Drupal\views\Plugin\views\relationship;
use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\HandlerBase;
use Drupal\views\Join;
use Drupal\Core\Annotation\Plugin;
@@ -45,12 +46,14 @@ use Drupal\Core\Annotation\Plugin;
abstract class RelationshipPluginBase extends HandlerBase {
/**
+ * Overrides \Drupal\views\Plugin\views\HandlerBase::init().
+ *
* Init handler to let relationships live on tables other than
* the table they operate on.
*/
- public function init(ViewExecutable $view, &$options) {
- $this->setOptionDefaults($this->options, $this->defineOptions());
- parent::init($view, $options);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
+
if (isset($this->definition['relationship table'])) {
$this->table = $this->definition['relationship table'];
}
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/row/RowPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/row/RowPluginBase.php
index c46071f..23ab931 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/row/RowPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/row/RowPluginBase.php
@@ -38,18 +38,6 @@ abstract class RowPluginBase extends PluginBase {
protected $usesFields = FALSE;
/**
- * Initialize the row plugin.
- */
- public function init(ViewExecutable $view, &$display, $options = NULL) {
- $this->setOptionDefaults($this->options, $this->defineOptions());
- $this->view = &$view;
- $this->displayHandler = &$display;
-
- // Overlay incoming options on top of defaults
- $this->unpackOptions($this->options, $options);
- }
-
- /**
* Returns the usesFields property.
*
* @return bool
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/sort/GroupByNumeric.php b/core/modules/views/lib/Drupal/views/Plugin/views/sort/GroupByNumeric.php
index e52bc06..59cefb0 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/sort/GroupByNumeric.php
+++ b/core/modules/views/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\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
/**
@@ -19,12 +20,15 @@ use Drupal\views\ViewExecutable;
*/
class GroupByNumeric extends SortPluginBase {
- public function init(ViewExecutable $view, &$options) {
- parent::init($view, $options);
+ /**
+ * Overrides \Drupal\views\Plugin\views\HandlerBase::init().
+ */
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
// Initialize the original handler.
$this->handler = views_get_handler($options['table'], $options['field'], 'sort');
- $this->handler->init($view, $options);
+ $this->handler->init($view, $display, $options);
}
/**
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/style/StylePluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/style/StylePluginBase.php
index abed751..b8b2eaa 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/style/StylePluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/style/StylePluginBase.php
@@ -8,6 +8,7 @@
namespace Drupal\views\Plugin\views\style;
use Drupal\views\Plugin\views\PluginBase;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\wizard\WizardInterface;
use Drupal\Core\Annotation\Plugin;
use Drupal\Core\Annotation\Translation;
@@ -80,20 +81,13 @@ abstract class StylePluginBase extends PluginBase {
protected $usesFields = FALSE;
/**
- * Initialize a style plugin.
+ * Overrides \Drupal\views\Plugin\views\PluginBase::init().
*
- * @param $view
- * @param $display
- * @param $options
- * 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.
+ * 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(ViewExecutable $view, &$display, $options = NULL) {
- $this->setOptionDefaults($this->options, $this->defineOptions());
- $this->view = &$view;
- $this->displayHandler = &$display;
-
- $this->unpackOptions($this->options, $options);
+ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+ parent::init($view, $display, $options);
if ($this->usesRowPlugin() && $display->getOption('row')) {
$this->row_plugin = $display->getPlugin('row');
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTest.php
index 2cc6c3e..a1fc6d1 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTest.php
@@ -79,7 +79,7 @@ class StyleTest extends ViewTestBase {
$view->initStyle();
$view->style_plugin->setUsesRowPlugin(TRUE);
// Reinitialize the style as it supports row plugins now.
- $view->style_plugin->init($view, $view->display_handler, array());
+ $view->style_plugin->init($view, $view->display_handler);
$this->assertTrue($view->style_plugin->row_plugin instanceof RowTest, 'Make sure the right row plugin class is loaded.');
$random_text = $this->randomName();
diff --git a/core/modules/views/lib/Drupal/views/ViewExecutable.php b/core/modules/views/lib/Drupal/views/ViewExecutable.php
index 6a8f79c7..d5aef7d 100644
--- a/core/modules/views/lib/Drupal/views/ViewExecutable.php
+++ b/core/modules/views/lib/Drupal/views/ViewExecutable.php
@@ -2214,7 +2214,7 @@ class ViewExecutable {
if (!empty($this->displayHandlers[$id])) {
// Initialize the new display handler with data.
- $this->displayHandlers[$id]->init($this, $display[$id]);
+ $this->displayHandlers[$id]->initDisplay($this, $display[$id]);
// If this is NOT the default display handler, let it know which is
if ($id != 'default') {
// @todo is the '&' still required in php5?
diff --git a/core/modules/views/views_ui/admin.inc b/core/modules/views/views_ui/admin.inc
index a41b3a3..65d2e8a 100644
--- a/core/modules/views/views_ui/admin.inc
+++ b/core/modules/views/views_ui/admin.inc
@@ -1445,7 +1445,7 @@ function views_ui_config_item_form($form, &$form_state) {
$base = $data[$relationship['field']]['relationship']['base'];
$base_fields = views_fetch_fields($base, $form_state['type'], $executable->display_handler->useGroupBy());
if (isset($base_fields[$item['table'] . '.' . $item['field']])) {
- $relationship_handler->init($executable, $relationship);
+ $relationship_handler->init($executable, $executable->display_handler, $relationship);
$relationship_options[$relationship['id']] = $relationship_handler->label();
}
}
@@ -1557,7 +1557,7 @@ function views_ui_config_item_form_submit_temporary($form, &$form_state) {
// Create a new handler and unpack the options from the form onto it. We
// can use that for storage.
$handler = views_get_handler($item['table'], $item['field'], $handler_type, $override);
- $handler->init($executable, $item);
+ $handler->init($executable, $executable->display_handler, $item);
// Add the incoming options to existing options because items using
// the extra form may not have everything in the form here.
@@ -1612,7 +1612,7 @@ function views_ui_config_item_form_submit($form, &$form_state) {
// Create a new handler and unpack the options from the form onto it. We
// can use that for storage.
$handler = views_get_handler($item['table'], $item['field'], $handler_type, $override);
- $handler->init($executable, $item);
+ $handler->init($executable, $executable->display_handler, $item);
// Add the incoming options to existing options because items using
// the extra form may not have everything in the form here.
@@ -1665,7 +1665,7 @@ function views_ui_config_item_group_form($type, &$form_state) {
$form['markup'] = array('#markup' => t("Error: handler for @table > @field doesn't exist!", array('@table' => $item['table'], '@field' => $item['field'])));
}
else {
- $handler->init($view, $item);
+ $handler->init($executable, $executable->display_handler, $item);
$types = ViewExecutable::viewsHandlerTypes();
$form['#title'] = t('Configure group settings for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->adminLabel()));
@@ -1688,12 +1688,13 @@ function views_ui_config_item_group_form_submit($form, &$form_state) {
$id = $form_state['id'];
$handler = views_get_handler($item['table'], $item['field'], $type);
- $handler->init($form_state['view']->get('executable'), $item);
+ $executable = $form_state['view']->get('executable');
+ $handler->init($executable, $executable->display_handler, $item);
$handler->submitGroupByForm($form, $form_state);
// Store the item back on the view
- $form_state['view']->get('executable')->setItem($form_state['display_id'], $form_state['type'], $form_state['id'], $item);
+ $executable->setItem($form_state['display_id'], $form_state['type'], $form_state['id'], $item);
// Write to cache
views_ui_cache_set($form_state['view']);
@@ -1767,7 +1768,7 @@ function views_ui_config_item_extra_form($form, &$form_state) {
$form['markup'] = array('#markup' => t("Error: handler for @table > @field doesn't exist!", array('@table' => $item['table'], '@field' => $item['field'])));
}
else {
- $handler->init($view, $item);
+ $handler->init($executable, $executable->display_handler, $item);
$types = ViewExecutable::viewsHandlerTypes();
$form['#title'] = t('Configure extra settings for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->adminLabel()));