You are here

public function Eva::getPath in EVA: Entity Views Attachment 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/views/display/Eva.php \Drupal\eva\Plugin\views\display\Eva::getPath()

Returns the base path to use for this display.

This can be overridden for displays that do strange things with the path.

Overrides DisplayPluginBase::getPath

File

src/Plugin/views/display/Eva.php, line 255

Class

Eva
The plugin that handles an EVA display in views.

Namespace

Drupal\eva\Plugin\views\display

Code

public function getPath() {
  if (isset($this->view->current_entity)) {

    /** @var \Drupal\Core\Entity\EntityInterface $current_entity */
    $current_entity = $this->view->current_entity;

    /** @var \Drupal\Core\Url $uri */
    $uri = $current_entity
      ->toUrl();
    if ($uri) {
      $uri
        ->setAbsolute(TRUE);
      return $uri
        ->toUriString();
    }
  }
  return parent::getPath();
}