function RelationshipPluginBase::defineOptions

Same name in other branches
  1. 8.9.x core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php \Drupal\views\Plugin\views\relationship\RelationshipPluginBase::defineOptions()
  2. 10 core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php \Drupal\views\Plugin\views\relationship\RelationshipPluginBase::defineOptions()
  3. 11.x core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php \Drupal\views\Plugin\views\relationship\RelationshipPluginBase::defineOptions()

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 89

Class

RelationshipPluginBase
Relationship plugin base.

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.