Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/Element/Pattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,14 @@ public static function processMultipleSources(array $element) {
if (count($field) > 1) {
/** @var \Drupal\ui_patterns\Element\PatternContext $context */
$context = $element['#context'];
$context->setProperty('pattern', $element['#id']);
$context->setProperty('field', $name);
$field_context = new PatternContext($context->getType(), $context->getProperties());
$field_context->setProperty('pattern', $element['#id']);
$field_context->setProperty('field', $name);

// Render multiple sources with "patterns_destination" template.
$element['#fields'][$name] = [
'#sources' => $field,
'#context' => $context,
'#context' => $field_context,
'#theme' => 'patterns_destination',
];
}
Expand Down
10 changes: 10 additions & 0 deletions src/Element/PatternContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ public function getProperty($name) {
return isset($this->properties[$name]) ? $this->properties[$name] : NULL;
}

/**
* Get pattern context properties.
*
* @return mixed
* All context properties.
*/
public function getProperties() {
return $this->properties;
}

/**
* Set pattern context property.
*
Expand Down