You are here

protected function EntityReference::defineOptions in Drupal 9

Same name in this branch
  1. 9 core/modules/views/src/Plugin/views/display/EntityReference.php \Drupal\views\Plugin\views\display\EntityReference::defineOptions()
  2. 9 core/modules/views/src/Plugin/views/style/EntityReference.php \Drupal\views\Plugin\views\style\EntityReference::defineOptions()
  3. 9 core/modules/views/src/Plugin/views/row/EntityReference.php \Drupal\views\Plugin\views\row\EntityReference::defineOptions()
Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/display/EntityReference.php \Drupal\views\Plugin\views\display\EntityReference::defineOptions()

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 DisplayPluginBase::defineOptions

File

core/modules/views/src/Plugin/views/display/EntityReference.php, line 84

Class

EntityReference
The plugin that handles an EntityReference display.

Namespace

Drupal\views\Plugin\views\display

Code

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

  // Force the style plugin to 'entity_reference_style' and the row plugin to
  // 'fields'.
  $options['style']['contains']['type'] = [
    'default' => 'entity_reference',
  ];
  $options['defaults']['default']['style'] = FALSE;
  $options['row']['contains']['type'] = [
    'default' => 'entity_reference',
  ];
  $options['defaults']['default']['row'] = FALSE;

  // Set the display title to an empty string (not used in this display type).
  $options['title']['default'] = '';
  $options['defaults']['default']['title'] = FALSE;
  return $options;
}