You are here

protected function LibraryPattern::processCustomThemeHookProperty in UI Patterns 8

Process 'custom hook theme' definition property.

Parameters

\Drupal\ui_patterns\Definition\PatternDefinition $definition: Pattern definition array.

Return value

array Processed hook definition portion.

1 call to LibraryPattern::processCustomThemeHookProperty()
LibraryPattern::getThemeImplementation in modules/ui_patterns_library/src/Plugin/UiPatterns/Pattern/LibraryPattern.php
Get theme implementation for current pattern.

File

modules/ui_patterns_library/src/Plugin/UiPatterns/Pattern/LibraryPattern.php, line 74

Class

LibraryPattern
The UI Pattern plugin.

Namespace

Drupal\ui_patterns_library\Plugin\UiPatterns\Pattern

Code

protected function processCustomThemeHookProperty(PatternDefinition $definition) {

  /** @var \Drupal\Core\Extension\Extension $module */
  $return = [];
  if (!$definition
    ->hasCustomThemeHook() && $this->moduleHandler
    ->moduleExists($definition
    ->getProvider())) {
    $module = $this->moduleHandler
      ->getModule($definition
      ->getProvider());
    $return['path'] = $module
      ->getPath() . '/templates';
    if ($this
      ->templateExists($definition
      ->getBasePath(), $definition
      ->getTemplate())) {
      $return['path'] = str_replace($this->root, '', $definition
        ->getBasePath());
    }
  }
  return $return;
}