You are here

trait ViewsContextTrait in Geolocation Field 8.3

Same name and namespace in other branches
  1. 8.2 src/ViewsContextTrait.php \Drupal\geolocation\ViewsContextTrait

Trait ViewsContextTrait.

Hierarchy

7 files declare their use of ViewsContextTrait
FirstRow.php in src/Plugin/geolocation/Location/FirstRow.php
ViewsBoundaryArgument.php in src/Plugin/geolocation/MapCenter/ViewsBoundaryArgument.php
ViewsBoundaryArgument.php in src/Plugin/geolocation/Location/ViewsBoundaryArgument.php
ViewsBoundaryFilter.php in src/Plugin/geolocation/MapCenter/ViewsBoundaryFilter.php
ViewsEntityArgument.php in src/Plugin/geolocation/Location/ViewsEntityArgument.php

... See full list

File

src/ViewsContextTrait.php, line 8

Namespace

Drupal\geolocation
View source
trait ViewsContextTrait {

  /**
   * Get display handler from context.
   *
   * @param mixed $context
   *   Context.
   *
   * @return bool|\Drupal\views\Plugin\views\display\DisplayPluginBase
   *   Display handler or FALSE.
   */
  protected static function getViewsDisplayHandler($context = NULL) {
    if (!is_object($context)) {
      return FALSE;
    }
    if (is_subclass_of($context, 'Drupal\\views\\Plugin\\views\\style\\StylePluginBase')) {

      /** @var \Drupal\views\Plugin\views\display\DisplayPluginBase $context */
      return $context->displayHandler;
    }
    if (is_subclass_of($context, 'Drupal\\views\\Plugin\\views\\HandlerBase')) {

      /** @var \Drupal\views\Plugin\views\display\DisplayPluginBase $context */
      return $context->displayHandler;
    }
    return FALSE;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ViewsContextTrait::getViewsDisplayHandler protected static function Get display handler from context.