You are here

public static function Pattern::processContext in UI Patterns 8

Process context.

Parameters

array $element: Render array.

Return value

array Render array.

Throws

\Drupal\ui_patterns\Exception\PatternRenderException Throws an exception if no context type is specified.

1 method overrides Pattern::processContext()
PatternPreview::processContext in src/Element/PatternPreview.php
Process context.

File

src/Element/Pattern.php, line 186

Class

Pattern
Renders a pattern element.

Namespace

Drupal\ui_patterns\Element

Code

public static function processContext(array $element) {
  if (self::hasValidContext($element)) {
    $context = $element['#context'];
    $element['#context'] = new PatternContext($context['type'], $element['#context']);
  }
  else {
    $element['#context'] = new PatternContext('empty');
  }
  return $element;
}