Skip to content
Snippets Groups Projects
Commit bd9e0b10 authored by Ilias Dimopoulos's avatar Ilias Dimopoulos
Browse files

Simplify the condition.

parent 429da59d
No related branches found
No related tags found
No related merge requests found
......@@ -158,7 +158,7 @@ function layout_builder_entity_view_alter(array &$build, EntityInterface $entity
// If the entity is displayed within a Layout Builder block and the current
// route is in the Layout Builder UI, then remove all contextual link
// placeholders.
if ($display instanceof LayoutBuilderEntityViewDisplay && strpos(strval($route_name), 'layout_builder.') === 0) {
if ($display instanceof LayoutBuilderEntityViewDisplay && !empty($route_name) && strpos($route_name, 'layout_builder.') === 0) {
unset($build['#contextual_links']);
}
}
......
......@@ -25,7 +25,10 @@ public static function getLabel() {
* {@inheritdoc}
*/
public function getContext() {
return 'is_layout_builder_ui.' . (int) (strpos(strval($this->routeMatch->getRouteName()), 'layout_builder.') !== 0);
if (!empty($this->routeMatch->getRouteName()) && strpos($this->routeMatch->getRouteName(), 'layout_builder.') === 0) {
return 'is_layout_builder_ui.1';
}
return 'is_layout_builder_ui.0';
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment