Skip to content
Snippets Groups Projects
Commit 2f9a2746 authored by Owen Bush's avatar Owen Bush
Browse files

Inherit standard options for computed fields in views

parent c2955f11
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,7 @@ function recurring_events_views_data_alter(array &$data) {
'title' => t('Event instance title'),
'help' => t('The inherited title of an event instance.'),
'id' => 'eventinstance_title',
'field_name' => 'title',
],
];
......@@ -46,6 +47,7 @@ function recurring_events_views_data_alter(array &$data) {
'title' => t('Event instance description'),
'help' => t('The inherited description of an event instance.'),
'id' => 'eventinstance_description',
'field_name' => 'description',
],
];
}
......@@ -4,6 +4,7 @@ namespace Drupal\recurring_events\Plugin\views\field;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ResultRow;
use Drupal\views\Plugin\views\field\EntityField;
/**
* Field handler to show the inherited event instance description.
......@@ -12,21 +13,6 @@ use Drupal\views\ResultRow;
*
* @ViewsField("eventinstance_description")
*/
class EventInstanceDescription extends FieldPluginBase {
/**
* {@inheritdoc}
*/
public function query() {
// Leave empty to avoid a query on this field.
}
/**
* {@inheritdoc}
*/
public function render(ResultRow $values) {
$event = $values->_entity;
return $event->getInheritedDescription();
}
class EventInstanceDescription extends EntityField {
}
......@@ -2,8 +2,7 @@
namespace Drupal\recurring_events\Plugin\views\field;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ResultRow;
use Drupal\views\Plugin\views\field\EntityField;
/**
* Field handler to show the inherited event instance title.
......@@ -12,21 +11,6 @@ use Drupal\views\ResultRow;
*
* @ViewsField("eventinstance_title")
*/
class EventInstanceTitle extends FieldPluginBase {
/**
* {@inheritdoc}
*/
public function query() {
// Leave empty to avoid a query on this field.
}
/**
* {@inheritdoc}
*/
public function render(ResultRow $values) {
$event = $values->_entity;
return $event->getInheritedTitle();
}
class EventInstanceTitle extends EntityField {
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment