You are here

public function PanelsDisplayVariant::getPattern in Panels 8.4

Same name and namespace in other branches
  1. 8.3 src/Plugin/DisplayVariant/PanelsDisplayVariant.php \Drupal\panels\Plugin\DisplayVariant\PanelsDisplayVariant::getPattern()

Gets the assigned PanelsPattern or falls back to the default pattern.

Return value

\Drupal\panels\Plugin\PanelsPattern\PanelsPatternInterface

File

src/Plugin/DisplayVariant/PanelsDisplayVariant.php, line 224

Class

PanelsDisplayVariant
Provides a display variant that simply contains blocks.

Namespace

Drupal\panels\Plugin\DisplayVariant

Code

public function getPattern() {
  if (!isset($this->pattern)) {
    if (empty($this->configuration['pattern'])) {
      $this->pattern = \Drupal::service('plugin.manager.panels.pattern')
        ->createInstance('default');
    }
    else {
      $this->pattern = \Drupal::service('plugin.manager.panels.pattern')
        ->createInstance($this->configuration['pattern']);
    }
  }
  return $this->pattern;
}