public static function Pattern::processFields in UI Patterns 8
Process fields.
Parameters
array $element: Render array.
Return value
array Render array.
1 call to Pattern::processFields()
- PatternPreview::processFields in src/
Element/ PatternPreview.php - Process fields.
1 method overrides Pattern::processFields()
- PatternPreview::processFields in src/
Element/ PatternPreview.php - Process fields.
File
- src/
Element/ Pattern.php, line 85
Class
- Pattern
- Renders a pattern element.
Namespace
Drupal\ui_patterns\ElementCode
public static function processFields(array $element) {
// Make sure we don't render anything in case fields are empty.
if (self::hasFields($element)) {
$fields = $element['#fields'];
unset($element['#fields']);
foreach ($fields as $name => $field) {
$key = '#' . $name;
$element[$key] = $field;
}
}
else {
$element['#markup'] = '';
}
return $element;
}