You are here

public static function Pattern::processRenderArray in UI Patterns 8

Process render array.

Parameters

array $element: Render array.

Return value

array Render array.

File

src/Element/Pattern.php, line 45

Class

Pattern
Renders a pattern element.

Namespace

Drupal\ui_patterns\Element

Code

public static function processRenderArray(array $element) {
  $element['#theme'] = UiPatterns::getPatternDefinition($element['#id'])
    ->getThemeHook();
  if (isset($element['#attributes']) && !empty($element['#attributes']) && is_array($element['#attributes'])) {
    $element['#attributes'] = new Attribute($element['#attributes']);
  }
  else {
    $element['#attributes'] = new Attribute();
  }
  unset($element['#type']);
  return $element;
}