Skip to content
Snippets Groups Projects
Commit 04bb980a authored by Florent Torregrosa's avatar Florent Torregrosa
Browse files

Issue #3505833 by grimreaper: Section Library support to update: remove check on routes.

parent 1a4e85e2
Branches
Tags
1 merge request!264Issue #3505833 by grimreaper: Section Library support to update: remove check on routes.
Pipeline #432522 passed
......@@ -72,7 +72,7 @@ class ElementPreRenderLayoutBuilder implements TrustedCallbackInterface {
// Remove link.
if (isset($layoutBuilderArea->remove) && $layoutBuilderArea->remove->isType('link')) {
$url = $layoutBuilderArea->remove->getProperty('url');
if ($url instanceof Url && $url->getRouteName() == 'layout_builder.remove_section') {
if ($url instanceof Url) {
$layoutBuilderArea->remove->addClass('mx-1');
$layoutBuilderArea->remove->setIcon(Bootstrap::icon('trash'));
$layoutBuilderArea->remove->setProperty('icon_position', 'icon_only');
......@@ -82,7 +82,7 @@ class ElementPreRenderLayoutBuilder implements TrustedCallbackInterface {
// Configure link.
if (isset($layoutBuilderArea->configure) && $layoutBuilderArea->configure->isType('link')) {
$url = $layoutBuilderArea->configure->getProperty('url');
if ($url instanceof Url && $url->getRouteName() == 'layout_builder.configure_section') {
if ($url instanceof Url) {
$layoutBuilderArea->configure->addClass('mx-1');
$layoutBuilderArea->configure->setIcon(Bootstrap::icon('pencil-fill'));
$layoutBuilderArea->configure->setProperty('icon_position', 'icon_only');
......@@ -106,7 +106,7 @@ class ElementPreRenderLayoutBuilder implements TrustedCallbackInterface {
$addBlockArea = $region->layout_builder_add_block;
if (isset($addBlockArea->link) && $addBlockArea->link->isType('link')) {
$url = $addBlockArea->link->getProperty('url');
if ($url instanceof Url && $url->getRouteName() == 'layout_builder.choose_block') {
if ($url instanceof Url) {
// Wrapper.
$addBlockArea->addClass([
'py-4',
......@@ -129,7 +129,7 @@ class ElementPreRenderLayoutBuilder implements TrustedCallbackInterface {
// Section Library: Add this template to library.
if (isset($layoutBuilderArea->add_template_to_library) && $layoutBuilderArea->add_template_to_library->isType('link')) {
$url = $layoutBuilderArea->add_template_to_library->getProperty('url');
if ($url instanceof Url && $url->getRouteName() == 'section_library.add_template_to_library') {
if ($url instanceof Url) {
$layoutBuilderArea->add_template_to_library->addClass([
'btn',
'btn-outline-secondary',
......@@ -152,7 +152,7 @@ class ElementPreRenderLayoutBuilder implements TrustedCallbackInterface {
// Section Library: Import from library.
if (isset($layoutBuilderArea->choose_template_from_library) && $layoutBuilderArea->choose_template_from_library->isType('link')) {
$url = $layoutBuilderArea->choose_template_from_library->getProperty('url');
if ($url instanceof Url && $url->getRouteName() == 'section_library.choose_template_from_library') {
if ($url instanceof Url) {
$layoutBuilderArea->choose_template_from_library->addClass([
'btn',
'btn-outline-secondary',
......@@ -165,7 +165,7 @@ class ElementPreRenderLayoutBuilder implements TrustedCallbackInterface {
// Section Library: Add to library.
if (isset($layoutBuilderArea->add_to_library) && $layoutBuilderArea->add_to_library->isType('link')) {
$url = $layoutBuilderArea->add_to_library->getProperty('url');
if ($url instanceof Url && $url->getRouteName() == 'section_library.add_section_to_library') {
if ($url instanceof Url) {
$layoutBuilderArea->add_to_library->addClass('mx-1');
$layoutBuilderArea->add_to_library->setIcon(Bootstrap::icon('folder-plus'));
$layoutBuilderArea->add_to_library->setProperty('icon_position', 'icon_only');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment