public function ScheduledTransitionsViewsData::getViewsData in Scheduled Transitions 8
Same name and namespace in other branches
- 2.x src/ScheduledTransitionsViewsData.php \Drupal\scheduled_transitions\ScheduledTransitionsViewsData::getViewsData()
Returns views data for the entity type.
Return value
array Views data in the format of hook_views_data().
Overrides EntityViewsData::getViewsData
File
- src/
ScheduledTransitionsViewsData.php, line 17
Class
- ScheduledTransitionsViewsData
- Provides views data for scheduled transitions.
Namespace
Drupal\scheduled_transitionsCode
public function getViewsData() : array {
$data = parent::getViewsData();
// Create a new revision link.
$data['scheduled_transition']['entity_revision_link'] = [
'field' => [
'id' => 'scheduled_transitions_revision_link',
],
'title' => $this
->t('Revision link'),
'help' => $this
->t('Link to the scheduled entity revision.'),
];
// Create a new FROM field.
$data['scheduled_transition']['state_from'] = [
'field' => [
'id' => 'scheduled_transitions_transition_from',
],
'title' => $this
->t('Previous State'),
'help' => $this
->t('The previous state of the content.'),
];
// Override the TO moderation state field.
$data['scheduled_transition']['moderation_state']['title'] = $this
->t('New State');
$data['scheduled_transition']['moderation_state']['field']['id'] = 'scheduled_transitions_transition_to';
return $data;
}