function panels_page_variant_create in Panels 8.4
Same name and namespace in other branches
- 8.3 panels.module \panels_page_variant_create()
Implements hook_ENTITY_TYPE_create().
We need to set the storage information on Panels displays being storaged in Page Manager as early as possible, to signal to Panels that features requiring Panels storage (like the IPE) are supported.
See also
File
- ./
panels.module, line 32 - panels.module
Code
function panels_page_variant_create(PageVariantInterface $page_variant) {
if ($page_variant
->getVariantPluginId() == 'panels_variant') {
/** @var \Drupal\panels\Plugin\DisplayVariant\PanelsDisplayVariant $panels_display */
$panels_display = $page_variant
->getVariantPlugin();
// At this point, it very likely that $page_variant->id() is NULL. But
// setting the storage type to 'page_manager' is enough to trigger Panels
// to offer the IPE as an option.
$panels_display
->setStorage('page_manager', $page_variant
->id());
}
}