You are here

protected function EntityPager::getRelationshipOptions in Entity Pager 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/views/style/EntityPager.php \Drupal\entity_pager\Plugin\views\style\EntityPager::getRelationshipOptions()

Gets any relationships in the view as options.

Return value

string[] Array of relationships, keyed by ID with the values of their Admin label.

1 call to EntityPager::getRelationshipOptions()
EntityPager::buildOptionsForm in src/Plugin/views/style/EntityPager.php
Provide a form to edit options for this plugin.

File

src/Plugin/views/style/EntityPager.php, line 227

Class

EntityPager
Style plugin to render a view for an Entity Pager.

Namespace

Drupal\entity_pager\Plugin\views\style

Code

protected function getRelationshipOptions() {
  $executable = $this->view;
  $relationships = $executable->display_handler
    ->getOption('relationships');
  $options = [];
  if (!empty($relationships)) {
    foreach ($relationships as $relationship) {
      $options[$relationship['id']] = $relationship['admin_label'];
    }
  }
  return $options;
}