diff --git a/core/modules/aggregator/aggregator.views.inc b/core/modules/aggregator/aggregator.views.inc index 35e9611..dde8e74 100644 --- a/core/modules/aggregator/aggregator.views.inc +++ b/core/modules/aggregator/aggregator.views.inc @@ -27,7 +27,6 @@ function aggregator_views_data() { 'help' => t('The unique ID of the aggregator item.'), 'field' => array( 'id' => 'numeric', - 'click sortable' => TRUE, ), 'argument' => array( 'id' => 'aggregator_iid', @@ -48,7 +47,6 @@ function aggregator_views_data() { 'field' => array( 'id' => 'aggregator_title_link', 'extra' => array('link'), - 'click sortable' => TRUE, ), 'argument' => array( 'id' => 'string', @@ -66,7 +64,6 @@ function aggregator_views_data() { 'help' => t('The link to the original source URL of the item.'), 'field' => array( 'id' => 'url', - 'click sortable' => TRUE, ), 'argument' => array( 'id' => 'string', @@ -84,7 +81,6 @@ function aggregator_views_data() { 'help' => t('The author of the original imported item.'), 'field' => array( 'id' => 'aggregator_xss', - 'click sortable' => TRUE, ), 'argument' => array( 'id' => 'string', @@ -102,7 +98,6 @@ function aggregator_views_data() { 'help' => t('The guid of the original imported item.'), 'field' => array( 'id' => 'xss', - 'click sortable' => TRUE, ), 'argument' => array( 'id' => 'string', @@ -120,7 +115,6 @@ function aggregator_views_data() { 'help' => t('The actual content of the imported item.'), 'field' => array( 'id' => 'aggregator_xss', - 'click sortable' => FALSE, ), 'argument' => array( 'id' => 'string', @@ -138,7 +132,6 @@ function aggregator_views_data() { 'help' => t('The date the original feed item was posted. (With some feeds, this will be the date it was imported.)'), 'field' => array( 'id' => 'date', - 'click sortable' => TRUE, ), 'sort' => array( 'id' => 'date', @@ -172,7 +165,6 @@ function aggregator_views_data() { 'help' => t('The unique ID of the aggregator feed.'), 'field' => array( 'id' => 'numeric', - 'click sortable' => TRUE, ), 'argument' => array( 'id' => 'aggregator_fid', @@ -193,7 +185,6 @@ function aggregator_views_data() { 'field' => array( 'id' => 'aggregator_title_link', 'extra' => array('link'), - 'click sortable' => TRUE, ), 'sort' => array( 'id' => 'standard', @@ -211,7 +202,6 @@ function aggregator_views_data() { 'help' => t('The link to the source URL of the feed.'), 'field' => array( 'id' => 'url', - 'click sortable' => TRUE, ), 'argument' => array( 'id' => 'string', @@ -229,7 +219,6 @@ function aggregator_views_data() { 'help' => t('The date the feed was last checked for new content.'), 'field' => array( 'id' => 'date', - 'click sortable' => TRUE, ), 'sort' => array( 'id' => 'date', @@ -247,7 +236,6 @@ function aggregator_views_data() { 'help' => t('The description of the aggregator feed.'), 'field' => array( 'id' => 'xss', - 'click sortable' => FALSE, ), 'filter' => array( 'id' => 'string', @@ -265,7 +253,6 @@ function aggregator_views_data() { 'help' => t('The date of the most recent new content on the feed.'), 'field' => array( 'id' => 'date', - 'click sortable' => TRUE, ), 'sort' => array( 'id' => 'date', @@ -300,7 +287,6 @@ function aggregator_views_data() { 'help' => t('The unique ID of the aggregator category.'), 'field' => array( 'id' => 'numeric', - 'click sortable' => TRUE, ), 'argument' => array( 'id' => 'aggregator_category_cid', @@ -320,7 +306,6 @@ function aggregator_views_data() { 'help' => t('The title of the aggregator category.'), 'field' => array( 'id' => 'aggregator_category', - 'click sortable' => TRUE, ), 'argument' => array( 'id' => 'string', 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 cf5eb97..28c9d0e 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 @@ -9,6 +9,9 @@ use Drupal\views\Plugin\views\argument\Numeric; use Drupal\Component\Annotation\PluginID; +use Drupal\Component\Utility\String; +use Drupal\Core\Database\Connection; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Argument handler to accept an aggregator category id. @@ -20,13 +23,56 @@ class CategoryCid extends Numeric { /** + * Database Service Object. + * + * @var \Drupal\Core\Database\Connection + */ + protected $database; + + /** + * Creates an instance of the plugin. + * + * @param \Symfony\Component\DependencyInjection\ContainerInterface $container + * The DI Container. + * @param array $configuration + * A configuration array containing information about the plugin instance. + * @param string $plugin_id + * The plugin ID for the plugin instance. + * @param array $plugin_definition + * The plugin implementation definition. + * + * @return static + * Returns an instance of this plugin. + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) { + return new static($configuration, $plugin_id, $plugin_definition, $container->get('database')); + } + + /** + * Constructs a Drupal\Component\Plugin\PluginBase object. + * + * @param array $configuration + * A configuration array containing information about the plugin instance. + * @param string $plugin_id + * The plugin_id for the plugin instance. + * @param array $plugin_definition + * The plugin implementation definition. + * @param \Drupal\Core\Database\Connection $database + * Database Service Object. + */ + public function __construct(array $configuration, $plugin_id, array $plugin_definition, Connection $database) { + parent::__construct($configuration, $plugin_id, $plugin_definition); + $this->database = $database; + } + + /** * {@inheritdoc} */ function titleQuery() { - $titles = db_query("SELECT title FROM {aggregator_category} where cid IN (:cid)", array(':cid' => $this->value))->fetchCol(); + $titles = $this->database->query("SELECT title FROM {aggregator_category} where cid IN (:cid)", array(':cid' => $this->value))->fetchCol(); return array_map(function ($title) { - return check_plain($title); + return String::checkPlain($title); }, $titles); } 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 49bbfcd..a7b69d4 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 @@ -9,6 +9,9 @@ use Drupal\views\Plugin\views\argument\Numeric; use Drupal\Component\Annotation\PluginID; +use Drupal\Component\Utility\String; +use Drupal\Core\Entity\EntityManager; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Argument handler to accept an aggregator feed id. @@ -20,14 +23,57 @@ class Fid extends Numeric { /** + * The entity manager service + * + * @var \Drupal\Core\Entity\EntityManager + */ + protected $entityManager; + + /** + * Creates an instance of the plugin. + * + * @param \Symfony\Component\DependencyInjection\ContainerInterface $container + * The DI Container. + * @param array $configuration + * A configuration array containing information about the plugin instance. + * @param string $plugin_id + * The plugin ID for the plugin instance. + * @param array $plugin_definition + * The plugin implementation definition. + * + * @return static + * Returns an instance of this plugin. + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) { + return new static($configuration, $plugin_id, $plugin_definition, $container->get('plugin.manager.entity')); + } + + /** + * Constructs a Drupal\Component\Plugin\PluginBase object. + * + * @param array $configuration + * A configuration array containing information about the plugin instance. + * @param string $plugin_id + * The plugin_id for the plugin instance. + * @param array $plugin_definition + * The plugin implementation definition. + * @param \Drupal\Core\Entity\EntityManager $entity_manager + * The entity manager. + */ + public function __construct(array $configuration, $plugin_id, array $plugin_definition, EntityManager $entity_manager) { + parent::__construct($configuration, $plugin_id, $plugin_definition); + $this->entityManager = $entity_manager; + } + + /** * {@inheritdoc} */ function titleQuery() { $titles = array(); - $feeds = \Drupal::service('plugin.manager.entity')->getStorageController('aggregator_feed')->load($this->value); + $feeds = $this->entityManager->getStorageController('aggregator_feed')->load($this->value); foreach ($feeds as $feed) { - $titles[] = check_plain($feed->label()); + $titles[] = String::checkPlain($feed->label()); } return $titles; } 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 2ca9376..433196a 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 @@ -9,6 +9,9 @@ use Drupal\views\Plugin\views\argument\Numeric; use Drupal\Component\Annotation\PluginID; +use Drupal\Component\Utility\String; +use Drupal\Core\Entity\EntityManager; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Argument handler to accept an aggregator item id. @@ -20,14 +23,57 @@ class Iid extends Numeric { /** + * The entity manager service + * + * @var \Drupal\Core\Entity\EntityManager + */ + protected $entityManager; + + /** + * Creates an instance of the plugin. + * + * @param \Symfony\Component\DependencyInjection\ContainerInterface $container + * The DI Container. + * @param array $configuration + * A configuration array containing information about the plugin instance. + * @param string $plugin_id + * The plugin ID for the plugin instance. + * @param array $plugin_definition + * The plugin implementation definition. + * + * @return static + * Returns an instance of this plugin. + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) { + return new static($configuration, $plugin_id, $plugin_definition, $container->get('plugin.manager.entity')); + } + + /** + * Constructs a Drupal\Component\Plugin\PluginBase object. + * + * @param array $configuration + * A configuration array containing information about the plugin instance. + * @param string $plugin_id + * The plugin_id for the plugin instance. + * @param array $plugin_definition + * The plugin implementation definition. + * @param \Drupal\Core\Entity\EntityManager $entity_manager + * The entity manager. + */ + public function __construct(array $configuration, $plugin_id, array $plugin_definition, EntityManager $entity_manager) { + parent::__construct($configuration, $plugin_id, $plugin_definition); + $this->entityManager = $entity_manager; + } + + /** * {@inheritdoc} */ function titleQuery() { $titles = array(); - $items = \Drupal::service('plugin.manager.entity')->getStorageController('aggregator_item')->load($this->value); + $items = $this->entityManager->getStorageController('aggregator_item')->load($this->value); foreach ($items as $feed) { - $titles[] = check_plain($feed->label()); + $titles[] = String::checkPlain($feed->label()); } return $titles; }