You are here

public function PollViewData::getViewsData in Poll 8

Returns views data for the entity type.

Return value

array Views data in the format of hook_views_data().

Overrides EntityViewsData::getViewsData

File

src/PollViewData.php, line 15

Class

PollViewData
Render controller for polls.

Namespace

Drupal\poll

Code

public function getViewsData() {
  $data = parent::getViewsData();
  $data['poll_field_data']['votes'] = array(
    'title' => 'Total votes',
    'help' => 'Displays the total number of votes.',
    'real field' => 'id',
    'field' => array(
      'id' => 'poll_totalvotes',
    ),
  );
  $data['poll_field_data']['status_with_runtime'] = array(
    'title' => 'Active with runtime',
    'help' => 'Displays the status with runtime.',
    'real field' => 'id',
    'field' => array(
      'id' => 'poll_status',
    ),
  );
  return $data;
}