function HandlerBase::setRelationship

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::setRelationship()
  2. 10 core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::setRelationship()
  3. 11.x core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::setRelationship()

Overrides ViewsHandlerInterface::setRelationship

File

core/modules/views/src/Plugin/views/HandlerBase.php, line 506

Class

HandlerBase
Base class for Views handler plugins.

Namespace

Drupal\views\Plugin\views

Code

public function setRelationship() {
    // Ensure this gets set to something.
    $this->relationship = NULL;
    // Don't process non-existent relationships.
    if (empty($this->options['relationship']) || $this->options['relationship'] == 'none') {
        return;
    }
    $relationship = $this->options['relationship'];
    // Ignore missing/broken relationships.
    if (empty($this->view->relationship[$relationship])) {
        return;
    }
    // Check to see if the relationship has already processed. If not, then we
    // cannot process it.
    if (empty($this->view->relationship[$relationship]->alias)) {
        return;
    }
    // Finally!
    $this->relationship = $this->view->relationship[$relationship]->alias;
}

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