You are here

protected function RelationshipPluginBase::defineOptions in Drupal 10

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()
  2. 9 core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php \Drupal\views\Plugin\views\relationship\RelationshipPluginBase::defineOptions()
1 call to RelationshipPluginBase::defineOptions()
NodeTermData::defineOptions in core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php
1 method overrides RelationshipPluginBase::defineOptions()
NodeTermData::defineOptions in core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php

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;
}