- Issue created by @FrankieD3
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
You can use the entity display repository service
- Status changed to Fixed
11 months ago 7:48pm 12 February 2024 - πΊπΈUnited States FrankieD3
Apologies for the late reply.
This was the solution! Thanks so much for your help.
Below is my refactored snippet.
function hook_preprocess_node(array &$variables) { /** @var \Drupal\node\NodeInterface $node */ $node = $variables['node']; /** @var \Drupal\Core\Entity\EntityDisplayRepository entity_display_repository */ $entity_display_repository = \Drupal::service('entity_display.repository'); $view_display = $entity_display_repository ->getViewDisplay($node->getEntityTypeId(), $node->bundle()); $variables['layout_builder_enabled'] = $view_display ->getThirdPartySetting('layout_builder', 'enabled'); }
- πΊπΈUnited States SocialNicheGuru
Was this added to Core?
Is there a patch?
Or is the solution in #3 a workaround?
Without a patch shouldn't this be active?Should the workaround be incorporated into core in someway?
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
This was a support request
- πΊπΈUnited States FrankieD3
I hadn't thought about it at the time, but #5 raises a good point.
Is the discrepancy between the view mode available at
$variables['view_mode']
and the real currently-active view mode worth raising Pan issue in core?Or is this perhaps by design, and I am misunderstanding the variable's intention?
Automatically closed - issue fixed for 2 weeks with no activity.