You are here

protected function RelationshipPluginBase::defineOptions in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php \Drupal\views\Plugin\views\relationship\RelationshipPluginBase::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 HandlerBase::defineOptions

2 calls to RelationshipPluginBase::defineOptions()
GroupwiseMax::defineOptions in core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php
Information about options for all kinds of purposes will be held here.
NodeTermData::defineOptions in core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php
Information about options for all kinds of purposes will be held here.
2 methods override RelationshipPluginBase::defineOptions()
GroupwiseMax::defineOptions in core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php
Information about options for all kinds of purposes will be held here.
NodeTermData::defineOptions in core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php
Information about options for all kinds of purposes will be held here.

File

core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php, line 87

Class

RelationshipPluginBase
Simple relationship handler that allows a new version of the primary table to be linked in.

Namespace

Drupal\views\Plugin\views\relationship

Code

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

  // Relationships definitions should define a default label, but if they
  // aren't get another default value.
  if (!empty($this->definition['label'])) {

    // Cast the label to a string since it is an object.
    // @see \Drupal\Core\StringTranslation\TranslatableMarkup
    $label = (string) $this->definition['label'];
  }
  else {
    $label = !empty($this->definition['field']) ? $this->definition['field'] : $this->definition['base field'];
  }
  $options['admin_label']['default'] = $label;
  $options['required'] = [
    'default' => FALSE,
  ];
  return $options;
}