diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/CategoryCid.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/CategoryCid.php index 7387dd2..cf5eb97 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/CategoryCid.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/CategoryCid.php @@ -8,24 +8,21 @@ namespace Drupal\aggregator\Plugin\views\argument; use Drupal\views\Plugin\views\argument\Numeric; -use Drupal\Component\Annotation\Plugin; +use Drupal\Component\Annotation\PluginID; /** * Argument handler to accept an aggregator category id. * * @ingroup views_argument_handlers * - * @Plugin( - * id = "aggregator_category_cid", - * module = "aggregator" - * ) + * @PluginID("aggregator_category_cid") */ class CategoryCid extends Numeric { /** - * Overrides \Drupal\views\Plugin\views\argument\Numeric::title_query(). + * {@inheritdoc} */ - function title_query() { + function titleQuery() { $titles = db_query("SELECT title FROM {aggregator_category} where cid IN (:cid)", array(':cid' => $this->value))->fetchCol(); return array_map(function ($title) { diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/Fid.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/Fid.php index f7b326a..49bbfcd 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/Fid.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/Fid.php @@ -8,24 +8,21 @@ namespace Drupal\aggregator\Plugin\views\argument; use Drupal\views\Plugin\views\argument\Numeric; -use Drupal\Component\Annotation\Plugin; +use Drupal\Component\Annotation\PluginID; /** * Argument handler to accept an aggregator feed id. * * @ingroup views_argument_handlers * - * @Plugin( - * id = "aggregator_fid", - * module = "aggregator" - * ) + * @PluginID("aggregator_fid") */ class Fid extends Numeric { /** - * Overrides \Drupal\views\Plugin\views\argument\Numeric::title_query(). + * {@inheritdoc} */ - function title_query() { + function titleQuery() { $titles = array(); $feeds = \Drupal::service('plugin.manager.entity')->getStorageController('aggregator_feed')->load($this->value); diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/Iid.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/Iid.php index 719369d..2ca9376 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/Iid.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/Iid.php @@ -8,24 +8,21 @@ namespace Drupal\aggregator\Plugin\views\argument; use Drupal\views\Plugin\views\argument\Numeric; -use Drupal\Component\Annotation\Plugin; +use Drupal\Component\Annotation\PluginID; /** * Argument handler to accept an aggregator item id. * * @ingroup views_argument_handlers * - * @Plugin( - * id = "aggregator_iid", - * module = "aggregator" - * ) + * @PluginID("aggregator_iid") */ class Iid extends Numeric { /** - * Overrides \Drupal\views\Plugin\views\argument\Numeric::title_query(). + * {@inheritdoc} */ - function title_query() { + function titleQuery() { $titles = array(); $items = \Drupal::service('plugin.manager.entity')->getStorageController('aggregator_item')->load($this->value); diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/Category.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/Category.php index 9972d03..0232d43 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/Category.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/Category.php @@ -10,22 +10,19 @@ use Drupal\views\Plugin\views\display\DisplayPluginBase; use Drupal\views\Plugin\views\field\FieldPluginBase; use Drupal\views\ViewExecutable; -use Drupal\Component\Annotation\Plugin; +use Drupal\Component\Annotation\PluginID; /** * Defines a simple renderer that allows linking to an aggregator category. * * @ingroup views_field_handlers * - * @Plugin( - * id = "aggregator_category", - * module = "aggregator" - * ) + * @PluginID("aggregator_category") */ class Category extends FieldPluginBase { /** - * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::init(). + * {@inheritdoc} */ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { parent::init($view, $display, $options); @@ -34,7 +31,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o } /** - * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::defineOptions(). + * {@inheritdoc} */ protected function defineOptions() { $options = parent::defineOptions(); @@ -44,7 +41,7 @@ protected function defineOptions() { } /** - * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::buildOptionsForm(). + * {@inheritdoc} */ public function buildOptionsForm(&$form, &$form_state) { $form['link_to_category'] = array( @@ -61,7 +58,7 @@ public function buildOptionsForm(&$form, &$form_state) { * * Data should be made XSS safe prior to calling this function. */ - function render_link($data, $values) { + protected function render_link($data, $values) { $cid = $this->get_value($values, 'cid'); if (!empty($this->options['link_to_category']) && !empty($cid) && $data !== NULL && $data !== '') { $this->options['alter']['make_link'] = TRUE; @@ -71,9 +68,9 @@ function render_link($data, $values) { } /** - * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::render(). + * {@inheritdoc} */ - function render($values) { + public function render($values) { $value = $this->get_value($values); return $this->render_link($this->sanitizeValue($value), $values); } diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/TitleLink.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/TitleLink.php index 8945de1..f208b65 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/TitleLink.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/TitleLink.php @@ -10,7 +10,7 @@ use Drupal\views\Plugin\views\display\DisplayPluginBase; use Drupal\views\Plugin\views\field\FieldPluginBase; use Drupal\views\ViewExecutable; -use Drupal\Component\Annotation\Plugin; +use Drupal\Component\Annotation\PluginID; /** * Defines a field handler that turns an item's title into a clickable link to @@ -18,15 +18,12 @@ * * @ingroup views_field_handlers * - * @Plugin( - * id = "aggregator_title_link", - * module = "aggregator" - * ) + * @PluginID("aggregator_title_link") */ class TitleLink extends FieldPluginBase { /** - * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::init(). + * {@inheritdoc} */ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { parent::init($view, $display, $options); @@ -35,7 +32,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o } /** - * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::defineOptions(). + * {@inheritdoc} */ protected function defineOptions() { $options = parent::defineOptions(); @@ -46,7 +43,7 @@ protected function defineOptions() { } /** - * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::buildOptionsForm(). + * {@inheritdoc} */ public function buildOptionsForm(&$form, &$form_state) { $form['display_as_link'] = array( @@ -58,15 +55,20 @@ public function buildOptionsForm(&$form, &$form_state) { } /** - * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::render(). + * {@inheritdoc} */ function render($values) { - $value = $this->get_value($values); + $value = $this->getValue($values); return $this->render_link($this->sanitizeValue($value), $values); } + /** + * Renders aggregator item's title as link. + * + * Data should be made XSS safe prior to calling this function. + */ protected function render_link($data, $values) { - $link = $this->get_value($values, 'link'); + $link = $this->getValue($values, 'link'); if (!empty($this->options['display_as_link'])) { $this->options['alter']['make_link'] = TRUE; $this->options['alter']['path'] = $link; diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/Xss.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/Xss.php index 609ed5a..eb20b6f 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/Xss.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/Xss.php @@ -8,24 +8,21 @@ namespace Drupal\aggregator\Plugin\views\field; use Drupal\views\Plugin\views\field\Xss as XssBase; -use Drupal\Component\Annotation\Plugin; +use Drupal\Component\Annotation\PluginID; /** * Filters htmls tags from item. * * @ingroup views_field_handlers * - * @Plugin( - * id = "aggregator_xss", - * module = "aggregator" - * ) + * @PluginID("aggregator_xss") */ class Xss extends XssBase { /** - * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::sanitizeValue(). + * {@inheritdoc} */ - protected function sanitizeValue($value, $type = NULL) { + public function sanitizeValue($value, $type = NULL) { if ($type == 'xss') { return aggregator_filter_xss($value); } diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/filter/CategoryCid.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/filter/CategoryCid.php index 4c343c2..ea8f1a6 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/filter/CategoryCid.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/filter/CategoryCid.php @@ -8,24 +8,21 @@ namespace Drupal\aggregator\Plugin\views\filter; use Drupal\views\Plugin\views\filter\InOperator; -use Drupal\Component\Annotation\Plugin; +use Drupal\Component\Annotation\PluginID; /** * Defines a filter handler that filters by aggregator category cid. * * @ingroup views_filter_handlers * - * @Plugin( - * id = "aggregator_category_cid", - * module = "aggregator" - * ) + * @PluginID("aggregator_category_cid") */ class CategoryCid extends InOperator { /** - * Overrides \Drupal\views\Plugin\views\filter\InOperator::get_value_options(). + * {@inheritdoc} */ - function get_value_options() { + function getValueOptions() { if (isset($this->value_options)) { return; } diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/row/Rss.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/row/Rss.php index 89d2c3d..ad6c933 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/row/Rss.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/row/Rss.php @@ -21,7 +21,7 @@ * title = @Translation("Aggregator item"), * help = @Translation("Display the aggregator item using the data from the original source."), * base = {"aggregator_item"}, - * type = "feed" + * display_types = {"feed"} * ) */ class Rss extends RowPluginBase { @@ -41,7 +41,7 @@ class Rss extends RowPluginBase { public $base_field = 'iid'; /** - * Overrides \Drupal\views\Plugin\views\row\RowPluginBase::defineOptions(). + * {@inheritdoc} */ protected function defineOptions() { $options = parent::defineOptions(); @@ -52,7 +52,7 @@ protected function defineOptions() { } /** - * Overrides \Drupal\views\Plugin\views\row\RowPluginBase::buildOptionsForm(). + * {@inheritdoc} */ public function buildOptionsForm(&$form, &$form_state) { $form['item_length'] = array( @@ -69,7 +69,7 @@ public function buildOptionsForm(&$form, &$form_state) { } /** - * Overrides \Drupal\views\Plugin\views\row\RowPluginBase::render(). + * {@inheritdoc} */ function render($row) { $entity = $row->_entity; diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Tests/Views/IntegrationTest.php b/core/modules/aggregator/lib/Drupal/aggregator/Tests/Views/IntegrationTest.php index 46c2dd1..da85242 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Tests/Views/IntegrationTest.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Tests/Views/IntegrationTest.php @@ -99,15 +99,15 @@ public function testAggregatorItemView() { // Ensure that the rendering of the linked title works as expected. foreach ($view->result as $row) { - $iid = $view->field['iid']->get_value($row); + $iid = $view->field['iid']->getValue($row); $expected_link = l($items[$iid]->title->value, $items[$iid]->link->value, array('absolute' => TRUE)); - $this->assertEqual($view->field['title']->advanced_render($row), $expected_link, 'Ensure the right link is generated'); + $this->assertEqual($view->field['title']->advancedRender($row), $expected_link, 'Ensure the right link is generated'); - $expected_author = filter_xss($items[$iid]->author->value, array()); - $this->assertEqual($view->field['author']->advanced_render($row), $expected_author, 'Ensure the author got filtered'); + $expected_author = aggregator_filter_xss($items[$iid]->author->value); + $this->assertEqual($view->field['author']->advancedRender($row), $expected_author, 'Ensure the author got filtered'); - $expected_description = aggregator_filter_xss($items[$iid]->description->value, array()); - $this->assertEqual($view->field['description']->advanced_render($row), $expected_description, 'Ensure the author got filtered'); + $expected_description = aggregator_filter_xss($items[$iid]->description->value); + $this->assertEqual($view->field['description']->advancedRender($row), $expected_description, 'Ensure the author got filtered'); } }