Commit 45e51b05 authored by alexpott's avatar alexpott

Issue #2355239 by kgoel | dawehner: Let AggregatorItemViewsData and...

Issue #2355239 by kgoel | dawehner: Let AggregatorItemViewsData and AggregatorFeedViewsData use EntityViewsData.
parent b913cea2
......@@ -7,27 +7,19 @@
namespace Drupal\aggregator;
use Drupal\views\EntityViewsData;
use Drupal\views\EntityViewsDataInterface;
/**
* Provides the views data for the aggregator feed entity type.
*/
class AggregatorFeedViewsData implements EntityViewsDataInterface {
class AggregatorFeedViewsData extends EntityViewsData implements EntityViewsDataInterface {
/**
* {@inheritdoc}
*/
public function getViewsData() {
$data = array();
$data['aggregator_feed']['table']['group'] = t('Aggregator feed');
$data['aggregator_feed']['table']['base'] = array(
'field' => 'fid',
'title' => t('Aggregator feed'),
);
$data['aggregator_feed']['table']['entity type'] = 'aggregator_feed';
$data = parent::getViewsData();
$data['aggregator_feed']['table']['join'] = array(
'aggregator_item' => array(
......@@ -36,128 +28,28 @@ public function getViewsData() {
),
);
$data['aggregator_feed']['fid'] = array(
'title' => t('Feed ID'),
'help' => t('The unique ID of the aggregator feed.'),
'field' => array(
'id' => 'numeric',
),
'argument' => array(
'id' => 'aggregator_fid',
'name field' => 'title',
'numeric' => TRUE,
),
'filter' => array(
'id' => 'numeric',
),
'sort' => array(
'id' => 'standard',
),
);
$data['aggregator_feed']['fid']['help'] = $this->t('The unique ID of the aggregator feed.');
$data['aggregator_feed']['fid']['argument']['id'] = 'aggregator_fid';
$data['aggregator_feed']['fid']['argument']['name field'] = 'title';
$data['aggregator_feed']['fid']['argument']['numeric'] = TRUE;
$data['aggregator_feed']['title'] = array(
'title' => t('Title'),
'help' => t('The title of the aggregator feed.'),
'field' => array(
'id' => 'aggregator_title_link',
'extra' => array('link'),
),
'sort' => array(
'id' => 'standard',
),
'filter' => array(
'id' => 'string',
),
'argument' => array(
'id' => 'string',
),
);
$data['aggregator_feed']['fid']['filter']['id'] = 'numeric';
$data['aggregator_feed']['url'] = array(
'title' => t('URL'),
'help' => t('The fully-qualified URL of the feed.'),
'field' => array(
'id' => 'url',
),
'argument' => array(
'id' => 'string',
),
'sort' => array(
'id' => 'standard',
),
'filter' => array(
'id' => 'string',
),
);
$data['aggregator_feed']['title']['help'] = $this->t('The title of the aggregator feed.');
$data['aggregator_feed']['title']['field']['id'] = 'aggregator_title_link';
$data['aggregator_feed']['argument']['id'] = 'string';
$data['aggregator_feed']['link'] = array(
'title' => t('Link'),
'help' => t('The link to the source URL of the feed.'),
'field' => array(
'id' => 'url',
),
'argument' => array(
'id' => 'string',
),
'sort' => array(
'id' => 'standard',
),
'filter' => array(
'id' => 'string',
),
);
$data['aggregator_feed']['url']['help'] = $this->t('The fully-qualified URL of the feed.');
$data['aggregator_feed']['checked'] = array(
'title' => t('Last checked'),
'help' => t('The date the feed was last checked for new content.'),
'field' => array(
'id' => 'date',
),
'sort' => array(
'id' => 'date',
),
'filter' => array(
'id' => 'date',
),
'argument' => array(
'id' => 'date',
),
);
$data['aggregator_feed']['link']['help'] = $this->t('The link to the source URL of the feed.');
$data['aggregator_feed']['description'] = array(
'title' => t('Description'),
'help' => t('The description of the aggregator feed.'),
'field' => array(
'id' => 'xss',
'click sortable' => FALSE,
),
'filter' => array(
'id' => 'string',
),
'argument' => array(
'id' => 'string',
),
'sort' => array(
'id' => 'standard',
),
);
$data['aggregator_feed']['checked']['help'] = $this->t('The date the feed was last checked for new content.');
$data['aggregator_feed']['modified'] = array(
'title' => t('Last modified'),
'help' => t('The date of the most recent new content on the feed.'),
'field' => array(
'id' => 'date',
),
'sort' => array(
'id' => 'date',
),
'filter' => array(
'id' => 'date',
),
'argument' => array(
'id' => 'date',
),
);
$data['aggregator_feed']['description']['help'] = $this->t('The description of the aggregator feed.');
$data['aggregator_feed']['description']['field']['id'] = 'xss';
$data['aggregator_feed']['description']['field']['click sortable'] = FALSE;
$data['aggregator_feed']['modified']['help'] = $this->t('The date of the most recent new content on the feed.');
return $data;
}
......
......@@ -7,150 +7,44 @@
namespace Drupal\aggregator;
use Drupal\views\EntityViewsData;
use Drupal\views\EntityViewsDataInterface;
/**
* Provides the views data for the aggregator item entity type.
*/
class AggregatorItemViewsData implements EntityViewsDataInterface {
class AggregatorItemViewsData extends EntityViewsData implements EntityViewsDataInterface {
/**
* {@inheritdoc}
*/
public function getViewsData() {
$data = array();
$data['aggregator_item']['table']['group'] = t('Aggregator');
$data['aggregator_item']['table']['base'] = array(
'field' => 'iid',
'title' => t('Aggregator item'),
'help' => t('Aggregator items are imported from external RSS and Atom news feeds.'),
);
$data['aggregator_item']['table']['entity type'] = 'aggregator_item';
$data['aggregator_item']['iid'] = array(
'title' => t('Item ID'),
'help' => t('The unique ID of the aggregator item.'),
'field' => array(
'id' => 'numeric',
),
'argument' => array(
'id' => 'aggregator_iid',
'name field' => 'title',
'numeric' => TRUE,
),
'filter' => array(
'id' => 'numeric',
),
'sort' => array(
'id' => 'standard',
),
);
$data['aggregator_item']['title'] = array(
'title' => t('Title'),
'help' => t('The title of the aggregator item.'),
'field' => array(
'id' => 'aggregator_title_link',
'extra' => array('link'),
),
'argument' => array(
'id' => 'string',
),
'sort' => array(
'id' => 'standard',
),
'filter' => array(
'id' => 'string',
),
);
$data['aggregator_item']['link'] = array(
'title' => t('Link'),
'help' => t('The link to the original source URL of the item.'),
'field' => array(
'id' => 'url',
),
'argument' => array(
'id' => 'string',
),
'sort' => array(
'id' => 'standard',
),
'filter' => array(
'id' => 'string',
),
);
$data['aggregator_item']['author'] = array(
'title' => t('Author'),
'help' => t('The author of the original imported item.'),
'field' => array(
'id' => 'aggregator_xss',
),
'argument' => array(
'id' => 'string',
),
'sort' => array(
'id' => 'standard',
),
'filter' => array(
'id' => 'string',
),
);
$data['aggregator_item']['guid'] = array(
'title' => t('GUID'),
'help' => t('The guid of the original imported item.'),
'field' => array(
'id' => 'standard',
),
'argument' => array(
'id' => 'string',
),
'sort' => array(
'id' => 'standard',
),
'filter' => array(
'id' => 'string',
),
);
$data['aggregator_item']['description'] = array(
'title' => t('Body'),
'help' => t('The actual content of the imported item.'),
'field' => array(
'id' => 'aggregator_xss',
'click sortable' => FALSE,
),
'argument' => array(
'id' => 'string',
),
'filter' => array(
'id' => 'string',
),
'sort' => array(
'id' => 'standard',
),
);
$data['aggregator_item']['timestamp'] = array(
'title' => t('Timestamp'),
'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',
),
'sort' => array(
'id' => 'date',
),
'filter' => array(
'id' => 'date',
),
'argument' => array(
'id' => 'date',
),
);
$data = parent::getViewsData();
$data['aggregator_item']['table']['base']['help'] = $this->t('Aggregator items are imported from external RSS and Atom news feeds.');
$data['aggregator_item']['iid']['help'] = $this->t('The unique ID of the aggregator item.');
$data['aggregator_item']['iid']['argument']['id'] = 'aggregator_iid';
$data['aggregator_item']['iid']['argument']['name field'] = 'title';
$data['aggregator_item']['iid']['argument']['numeric'] = TRUE;
$data['aggregator_item']['title']['help'] = $this->t('The title of the aggregator item.');
$data['aggregator_item']['title']['field']['id'] = 'aggregator_title_link';
$data['aggregator_item']['title']['field']['extra'] = 'link';
$data['aggregator_item']['link']['help'] = $this->t('The link to the original source URL of the item.');
$data['aggregator_item']['author']['help'] = $this->t('The author of the original imported item.');
$data['aggregator_item']['author']['field']['id'] = 'aggregator_xss';
$data['aggregator_item']['guid']['help'] = $this->t('The guid of the original imported item.');
$data['aggregator_item']['description']['help'] = $this->t('The actual content of the imported item.');
$data['aggregator_item']['description']['field']['id'] = 'aggregator_xss';
$data['aggregator_item']['description']['field']['click sortable'] = FALSE;
$data['aggregator_item']['timestamp']['help'] = $this->t('The date the original feed item was posted. (With some feeds, this will be the date it was imported.)');
return $data;
}
......
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