Skip to content
Snippets Groups Projects
Commit a0ccce9f authored by Chris Eastwood's avatar Chris Eastwood
Browse files

Include element defaults in PatternLayout so pattern layouts render properly in panels

parent dbea4ad0
Branches
Tags
No related merge requests found
......@@ -8,6 +8,7 @@ use Drupal\Core\Layout\LayoutDefinition;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Plugin\PluginFormInterface;
use Drupal\ui_patterns\UiPatternsManager;
use Drupal\Core\Render\ElementInfoManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
......@@ -24,6 +25,13 @@ class PatternLayout extends LayoutDefault implements PluginFormInterface, Contai
*/
protected $patternManager = NULL;
/**
* The element info.
*
* @var \Drupal\Core\Render\ElementInfoManagerInterface
*/
protected $elementInfo;
/**
* Constructs a LocalActionDefault object.
*
......@@ -36,8 +44,9 @@ class PatternLayout extends LayoutDefault implements PluginFormInterface, Contai
* @param \Drupal\ui_patterns\UiPatternsManager $pattern_manager
* Pattern manager service.
*/
public function __construct(array $configuration, $plugin_id, LayoutDefinition $plugin_definition, UiPatternsManager $pattern_manager) {
public function __construct(array $configuration, $plugin_id, LayoutDefinition $plugin_definition, ElementInfoManagerInterface $element_info, UiPatternsManager $pattern_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->elementInfo = $element_info;
$this->patternManager = $pattern_manager;
}
......@@ -49,6 +58,7 @@ class PatternLayout extends LayoutDefault implements PluginFormInterface, Contai
$configuration,
$plugin_id,
$plugin_definition,
$container->get('plugin.manager.element_info'),
$container->get('plugin.manager.ui_patterns')
);
}
......@@ -74,7 +84,7 @@ class PatternLayout extends LayoutDefault implements PluginFormInterface, Contai
'#type' => 'pattern',
'#id' => $this->getPluginDefinition()->get('additional')['pattern'],
'#fields' => $fields,
];
] + $this->elementInfo->getInfo('pattern');
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment