Commit 30dda221 authored by dawehner's avatar dawehner Committed by tim.plunkett

Issue #1789948 by dawehner: Convert PluginBase::__construct() to PluginBase::init() where possible.

parent 66a2ca89
......@@ -8,8 +8,8 @@
namespace Drupal\views\Plugin\views\argument;
use Drupal\views\Plugin\views\PluginBase;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\HandlerBase;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
/**
* @defgroup views_argument_handlers Views argument handlers
......@@ -62,10 +62,10 @@ abstract class ArgumentPluginBase extends HandlerBase {
var $name_field;
/**
* Constructs a ArgumentPluginBase object.
* Overrides Drupal\views\Plugin\views\HandlerBase:init().
*/
public function __construct(array $configuration, $plugin_id, DiscoveryInterface $discovery) {
parent::__construct($configuration, $plugin_id, $discovery);
public function init(ViewExecutable $view, &$options) {
parent::init($view, $options);
if (!empty($this->definition['name field'])) {
$this->name_field = $this->definition['name field'];
......
......@@ -8,7 +8,7 @@
namespace Drupal\views\Plugin\views\argument;
use Drupal\Core\Annotation\Plugin;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
use Drupal\views\ViewExecutable;
/**
* Abstract argument handler for simple formulae.
......@@ -29,10 +29,10 @@ class Formula extends ArgumentPluginBase {
var $formula = NULL;
/**
* Constructs a Formula object.
* Overrides Drupal\views\Plugin\views\argument\ArgumentPluginBase::init().
*/
public function __construct(array $configuration, $plugin_id, DiscoveryInterface $discovery) {
parent::__construct($configuration, $plugin_id, $discovery);
public function init(ViewExecutable $view, &$options) {
parent::init($view, $options);
if (!empty($this->definition['formula'])) {
$this->formula = $this->definition['formula'];
......
......@@ -8,8 +8,8 @@
namespace Drupal\views\Plugin\views\field;
use Drupal\views\Plugin\views\HandlerBase;
use Drupal\views\ViewExecutable;
use Drupal\Core\Annotation\Plugin;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
/**
* @defgroup views_field_handlers Views field handlers
......@@ -68,10 +68,10 @@ abstract class FieldPluginBase extends HandlerBase {
var $additional_fields = array();
/**
* Constructs a FieldPluginBase object.
* Overrides Drupal\views\Plugin\views\HandlerBase::init().
*/
public function __construct(array $configuration, $plugin_id, DiscoveryInterface $discovery) {
parent::__construct($configuration, $plugin_id, $discovery);
public function init(ViewExecutable $view, &$options) {
parent::init($view, $options);
$this->additional_fields = array();
if (!empty($this->definition['additional fields'])) {
......
......@@ -8,7 +8,7 @@
namespace Drupal\views\Plugin\views\filter;
use Drupal\Core\Annotation\Plugin;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
use Drupal\views\ViewExecutable;
/**
* Simple filter to handle matching of boolean values
......@@ -40,10 +40,10 @@ class BooleanOperator extends FilterPluginBase {
var $accept_null = FALSE;
/**
* Constructs a BooleanOperator object.
* Overrides Drupal\views\Plugin\views\filter\FilterPluginBase::init().
*/
public function __construct(array $configuration, $plugin_id, DiscoveryInterface $discovery) {
parent::__construct($configuration, $plugin_id, $discovery);
public function init(ViewExecutable $view, &$options) {
parent::init($view, $options);
$this->value_value = t('True');
if (isset($this->definition['label'])) {
......
......@@ -8,7 +8,7 @@
namespace Drupal\views\Plugin\views\filter;
use Drupal\Core\Annotation\Plugin;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
use Drupal\views\ViewExecutable;
/**
* Simple filter to handle matching of multiple options selectable via checkboxes
......@@ -34,10 +34,10 @@ class InOperator extends FilterPluginBase {
var $value_options = NULL;
/**
* Constructs a BooleanOperator object.
* Overrides Drupal\views\Plugin\views\filter\FilterPluginBase::init().
*/
public function __construct(array $configuration, $plugin_id, DiscoveryInterface $discovery) {
parent::__construct($configuration, $plugin_id, $discovery);
public function init(ViewExecutable $view, &$options) {
parent::init($view, $options);
$this->value_title = t('Options');
$this->value_options = NULL;
......
......@@ -8,6 +8,7 @@
namespace Views\aggregator\Plugin\views\field;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\Core\Annotation\Plugin;
/**
......@@ -24,10 +25,10 @@
class Category extends FieldPluginBase {
/**
* Constructs a Category object.
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
public function __construct(array $configuration, $plugin_id, DiscoveryInterface $discovery) {
parent::__construct($configuration, $plugin_id, $discovery);
public function init(ViewExecutable $view, &$options) {
parent::init($view, $options);
$this->additional_fields['cid'] = 'cid';
}
......
......@@ -8,8 +8,8 @@
namespace Views\aggregator\Plugin\views\field;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\Core\Annotation\Plugin;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
/**
* Field handler that turns an item's title into a clickable link to the original
......@@ -25,10 +25,10 @@
class TitleLink extends FieldPluginBase {
/**
* Constructs a Category object.
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
public function __construct(array $configuration, $plugin_id, DiscoveryInterface $discovery) {
parent::__construct($configuration, $plugin_id, $discovery);
public function init(ViewExecutable $view, &$options) {
parent::init($view, $options);
$this->additional_fields['link'] = 'link';
}
......
......@@ -8,8 +8,8 @@
namespace Views\comment\Plugin\views\field;
use Drupal\views\Plugin\views\field\Date;
use Drupal\views\ViewExecutable;
use Drupal\Core\Annotation\Plugin;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
/**
* Field handler to display the timestamp of a comment with the count of comments.
......@@ -24,10 +24,10 @@
class LastTimestamp extends Date {
/**
* Constructs a LastTimestamp object.
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
public function __construct(array $configuration, $plugin_id, DiscoveryInterface $discovery) {
parent::__construct($configuration, $plugin_id, $discovery);
public function init(ViewExecutable $view, &$options) {
parent::init($view, $options);
$this->additional_fields['comment_count'] = 'comment_count';
}
......
......@@ -8,8 +8,8 @@
namespace Views\comment\Plugin\views\field;
use Drupal\views\Plugin\views\field\Numeric;
use Drupal\views\ViewExecutable;
use Drupal\Core\Annotation\Plugin;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
/**
* Field handler to display the number of new comments.
......@@ -24,10 +24,10 @@
class NodeNewComments extends Numeric {
/**
* Constructs a NodeNewComments object.
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
public function __construct(array $configuration, $plugin_id, DiscoveryInterface $discovery) {
parent::__construct($configuration, $plugin_id, $discovery);
public function init(ViewExecutable $view, &$options) {
parent::init($view, $options);
$this->additional_fields['nid'] = 'nid';
$this->additional_fields['type'] = 'type';
......
......@@ -8,8 +8,8 @@
namespace Views\filter\Plugin\views\field;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\Core\Annotation\Plugin;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
/**
* Field handler to output the name of an input format.
......@@ -24,10 +24,10 @@
class FormatName extends FieldPluginBase {
/**
* Constructs a FormatName object.
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
public function __construct(array $configuration, $plugin_id, DiscoveryInterface $discovery) {
parent::__construct($configuration, $plugin_id, $discovery);
public function init(ViewExecutable $view, &$options) {
parent::init($view, $options);
// Be explicit about the table we are using.
$this->additional_fields['name'] = array('table' => 'filter_formats', 'field' => 'name');
......
......@@ -7,9 +7,9 @@
namespace Views\locale\Plugin\views\field;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\Core\Annotation\Plugin;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
/**
* Field handler to present a link to edit a translation.
......@@ -24,10 +24,10 @@
class LinkEdit extends FieldPluginBase {
/**
* Constructs a LinkEdit object.
* Overrides Drupal\views\Plugin\views\HandlerBase::init().
*/
public function __construct(array $configuration, $plugin_id, DiscoveryInterface $discovery) {
parent::__construct($configuration, $plugin_id, $discovery);
public function init(ViewExecutable $view, &$options) {
parent::init($view, $options);
$this->additional_fields['lid'] = 'lid';
}
......
......@@ -8,8 +8,8 @@
namespace Views\node\Plugin\views\field;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\Core\Annotation\Plugin;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
/**
* Field handler to present the path to the node.
......@@ -24,10 +24,10 @@
class Path extends FieldPluginBase {
/**
* Constructs a Path object.
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
public function __construct(array $configuration, $plugin_id, DiscoveryInterface $discovery) {
parent::__construct($configuration, $plugin_id, $discovery);
public function init(ViewExecutable $view, &$options) {
parent::init($view, $options);
$this->additional_fields['nid'] = 'nid';
}
......
......@@ -8,8 +8,8 @@
namespace Views\node\Plugin\views\field;
use Views\node\Plugin\views\field\Link;
use Drupal\views\ViewExecutable;
use Drupal\Core\Annotation\Plugin;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
/**
* Field handler to present a link to a node revision.
......@@ -24,10 +24,10 @@
class RevisionLink extends Link {
/**
* Constructs a RevisionLink object.
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
public function __construct(array $configuration, $plugin_id, DiscoveryInterface $discovery) {
parent::__construct($configuration, $plugin_id, $discovery);
public function init(ViewExecutable $view, &$options) {
parent::init($view, $options);
$this->additional_fields['node_vid'] = array('table' => 'node_revision', 'field' => 'vid');
}
......
......@@ -8,8 +8,8 @@
namespace Views\taxonomy\Plugin\views\field;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\Core\Annotation\Plugin;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
/**
* Field handler to present a term edit link.
......@@ -24,10 +24,10 @@
class LinkEdit extends FieldPluginBase {
/**
* Constructs a LinkEdit object.
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
public function __construct(array $configuration, $plugin_id, DiscoveryInterface $discovery) {
parent::__construct($configuration, $plugin_id, $discovery);
public function init(ViewExecutable $view, &$options) {
parent::init($view, $options);
$this->additional_fields['tid'] = 'tid';
$this->additional_fields['vid'] = 'vid';
......
......@@ -8,8 +8,8 @@
namespace Views\taxonomy\Plugin\views\field;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\Core\Annotation\Plugin;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;;
/**
* Field handler to provide simple renderer that allows linking to a taxonomy
......@@ -27,13 +27,13 @@
class Taxonomy extends FieldPluginBase {
/**
* Constructs a Taxonomy object.
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
*
* This constructer assumes the taxonomy_term_data table. If using another
* table, we'll need to be more specific.
* This method assumes the taxonomy_term_data table. If using another table,
* we'll need to be more specific.
*/
public function __construct(array $configuration, $plugin_id, DiscoveryInterface $discovery) {
parent::__construct($configuration, $plugin_id, $discovery);
public function init(ViewExecutable $view, &$options) {
parent::init($view, $options);
$this->additional_fields['vid'] = 'vid';
$this->additional_fields['tid'] = 'tid';
......
......@@ -8,8 +8,8 @@
namespace Views\translation\Plugin\views\field;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\Core\Annotation\Plugin;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
/**
* Field handler to present a link to the node.
......@@ -24,10 +24,10 @@
class NodeTranslationLink extends FieldPluginBase {
/**
* Constructs a NodeTranslationLink object.
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
public function __construct(array $configuration, $plugin_id, DiscoveryInterface $discovery) {
parent::__construct($configuration, $plugin_id, $discovery);
public function init(ViewExecutable $view, &$options) {
parent::init($view, $options);
$this->additional_fields['nid'] = 'nid';
$this->additional_fields['tnid'] = 'tnid';
......
......@@ -8,8 +8,8 @@
namespace Views\user\Plugin\views\field;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\Core\Annotation\Plugin;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
/**
* Field handler to present a link to the user.
......@@ -24,10 +24,10 @@
class Link extends FieldPluginBase {
/**
* Constructs a Link object.
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
public function __construct(array $configuration, $plugin_id, DiscoveryInterface $discovery) {
parent::__construct($configuration, $plugin_id, $discovery);
public function init(ViewExecutable $view, &$options) {
parent::init($view, $options);
$this->additional_fields['uid'] = 'uid';
}
......
......@@ -8,8 +8,8 @@
namespace Views\user\Plugin\views\field;
use Drupal\Core\Annotation\Plugin;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\field\PrerenderList;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
/**
* Field handler to provide a list of permissions.
......@@ -24,10 +24,10 @@
class Permissions extends PrerenderList {
/**
* Constructs a Permissions object.
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
public function __construct(array $configuration, $plugin_id, DiscoveryInterface $discovery) {
parent::__construct($configuration, $plugin_id, $discovery);
public function init(ViewExecutable $view, &$options) {
parent::init($view, $options);
$this->additional_fields['uid'] = array('table' => 'users', 'field' => 'uid');
}
......
......@@ -8,8 +8,8 @@
namespace Views\user\Plugin\views\field;
use Drupal\Core\Annotation\Plugin;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
/**
* Field handler to provide simple renderer that allows using a themed user link.
......@@ -24,10 +24,10 @@
class Picture extends FieldPluginBase {
/**
* Constructs a Picture object.
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
public function __construct(array $configuration, $plugin_id, DiscoveryInterface $discovery) {
parent::__construct($configuration, $plugin_id, $discovery);
public function init(ViewExecutable $view, &$options) {
parent::init($view, $options);
$this->additional_fields['uid'] = 'uid';
$this->additional_fields['name'] = 'name';
......
......@@ -8,8 +8,8 @@
namespace Views\user\Plugin\views\field;
use Drupal\Core\Annotation\Plugin;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\field\PrerenderList;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
/**
* Field handler to provide a list of roles.
......@@ -24,10 +24,10 @@
class Roles extends PrerenderList {
/**
* Constructs a Roles object.
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
public function __construct(array $configuration, $plugin_id, DiscoveryInterface $discovery) {
parent::__construct($configuration, $plugin_id, $discovery);
public function init(ViewExecutable $view, &$options) {
parent::init($view, $options);
$this->additional_fields['uid'] = array('table' => 'users', 'field' => 'uid');
}
......
......@@ -8,8 +8,8 @@
namespace Views\user\Plugin\views\filter;
use Drupal\Core\Annotation\Plugin;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\filter\BooleanOperator;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
/**
* Filter handler for the current user.
......@@ -24,10 +24,10 @@
class Current extends BooleanOperator {
/**
* Constructs a Current object.
* Overrides Drupal\views\Plugin\views\filter\BooleanOperator::init().
*/
public function __construct(array $configuration, $plugin_id, DiscoveryInterface $discovery) {
parent::__construct($configuration, $plugin_id, $discovery);
public function init(ViewExecutable $view, &$options) {
parent::init($view, $options);
$this->value_value = t('Is the logged in user');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment