You are here

protected function EREFNodeTitles::defineOptions in Entity Reference Exposed Filters 8

Information about options for all kinds of purposes will be held here.


'option_name' => array(
 - 'default' => default value,
 - 'contains' => (optional) array of items this contains, with its own
     defaults, etc. If contains is set, the default will be ignored and
     assumed to be array().
 ),

Return value

array Returns the options of this handler/plugin.

Overrides ManyToOne::defineOptions

1 call to EREFNodeTitles::defineOptions()
EREFNodeTitles::submitExtraOptionsForm in src/Plugin/views/filter/EREFNodeTitles.php
Perform any necessary changes to the form values prior to storage. There is no need for this function to actually store the data.

File

src/Plugin/views/filter/EREFNodeTitles.php, line 267

Class

EREFNodeTitles
Filters by given list of related content title options.

Namespace

Drupal\entity_reference_exposed_filters\Plugin\views\filter

Code

protected function defineOptions() {
  $options = parent::defineOptions();

  // Always exposed.
  $options['exposed'] = [
    'default' => 1,
  ];

  // Get the relationships. set the first as the default.
  if (isset($this->getRelationships)) {
    $relationship_field_names = array_keys($this->getRelationships);
    $options['relationship'] = [
      'default' => $relationship_field_names[0],
      $this->getRelationships,
    ];

    // Set the sort defaults. always numeric.
    // Compare with sort options private arrays to get value for sort.
    $options['sort_order'] = [
      'default' => 0,
    ];
    $options['sort_by'] = [
      'default' => 1,
    ];
    $options['get_unpublished'] = [
      'default' => 1,
    ];
    $options['get_filter_no_results'] = [
      'default' => 1,
    ];
  }
  return $options;
}