The layouts call a display suite class and if the module is not present, this happens:

Drupal\Component\Plugin\Exception\PluginException: Plugin (bb_cardbasic) instance class "Drupal\ds\Plugin\DsLayout" does not exist. in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (line 97 of /app/web/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php).

This will cause the add section link to fail. I will include a patch below to remove the class call.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

labboy0276 created an issue. See original summary.

labboy0276’s picture

Title: Display Suite classes breaks Layout Builder if not installed » Display Suite classes breaks Layout Builder if Display Suite is not installed
labboy0276’s picture

Here is the patch

hatuhay’s picture

Thanks for your report and patch.

  1. But if patch is applied ds layouts would not work.
  2. On the other hand DS should not be a dependency for Barrio.
  3. Creating a module is not an option
  4. There is no way to test DS module presence to decide call or not

I will sleep on this because right now I have no clue.

labboy0276’s picture

You could revise the layout so they are not DS dependent. Not sure why you did it that way, but that is my best guess.

hatuhay’s picture

Still no clear way to solve.
The layouts require a class to lean on, in this case it is DS.
To avoid dependency from DS or other module, the theme should declare their own class, but that is not posible as themes cannot declare services.

candelas’s picture

Hello

I was having this problem with Barrio 8.x-4.15 (no Display Suite installed and Layout Builder giving the error) and I applied the patch in #3 and now I can use Layout Builder.

Thanks @labboy0276

alexrayu’s picture

Encountered the same issue. If the theme requires DS, it should be a correct requirement in the info.yml file.

alexrayu’s picture

Seems like the theme needs to be upgraded to run with 8.6. Classes are not needed unless you want to do custom php processing. https://www.drupal.org/docs/8/api/layout-api/how-to-register-layouts

The default class it should be compatible with is \Drupal\Core\Layout\LayoutDefault

alexrayu’s picture

@hatuhay: If I convert the layouts to support the new default class, will you use them? Or is there another reason why you stick with the DS?

hctom’s picture

Issue summary: View changes

Just stumbled upon this issue: As layouts are plugins, you may use a deriver to create plugin definitions - and this gives you the option to check is DS module is enabled.

But all in all: Layout plugins always use a default class, so there is no need to use the DsLayout class for them, except this class provides some special stuff you rely on.

For now I would definitely appreciate to remove that DS dependency, because it shouldn't be necessary and users should decide on their own, which layout module they want to use.

hctom’s picture

Issue summary: View changes

Accidentally added my last comment line to the issue body ;)

hatuhay’s picture

If a patch is provided I will be very happy to apply.
The theme does no depend on DS and it should not, but do not want to loose the oportunity to add special layouts from DS or any other module.

pclaitte’s picture

Why we don't simply removes layout functionality in Barrio Theme ?
In my case, I have a sub theme of Barrio and y can define my layout as I want

labboy0276’s picture

The patch I wrote for this still resolves the issue. If you are trying to use Layout Builder, it will not work without the patch in #3. I do agree with the comment in #14 as well. I always use a subtheme and define my own layouts. Maybe just get rid of the layouts if not willing to add patch in?

Or better yet create a submodule called barrio layouts and have it dependent on DS for this who want to use your layouts?

Also, there is this module: https://www.drupal.org/project/layout_builder_restrictions to remove layouts and fields, etc. Maybe this can solve the problem?

pclaitte’s picture

I have tried the module layout_builder_restriction. It works for me.
Thanks @labboy0276

andypost’s picture

Title: Display Suite classes breaks Layout Builder if Display Suite is not installed » Display Suite classes breaks Layout Buildeзr if Display Suite is not installed
Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 3: 2976934-3.patch, failed testing. View results

andypost’s picture

Title: Display Suite classes breaks Layout Buildeзr if Display Suite is not installed » Display Suite classes breaks Layout Builder if Display Suite is not installed
Related issues: +#474684: Allow themes to declare dependencies on modules

Hheme could use hook layout discovery to inject DS classes if module ds is enabled or define dependency on module

MLZR’s picture

I have tried the module layout_builder_restriction. It works for me.
Don't check the layouts from the theme, only from core. Then it works.
Thanks @labboy0276

playful’s picture

Is there a solution to this and plan to fix it in the next stable release?

I do not have DS installed.

The layout builder UI works fine with the bartik theme, but I am unable to use it with my barrio subtheme unless I install and configure layout_builder_restrictions.

labboy0276’s picture

@playful, you can use the patch I put on the issue or the layout_builder_restriction module for now. The maintainer said they won't be changing the DS classes in the layout config.

jweirather’s picture

I'm getting this exact error message when I try to uninstall a module through Extend/Uninstall, on a site that is using Barrio and Layout Builder. The error occurs when trying to navigate to the "Uninstall" page from the "Extend" page.

Layout Builder Restrictions DID work for using Layout Builder earlier in the building process.

This issues with "Uninstall" wasn't discovered until later...The patch in #3 was successful, and appears for my current install to be required in order to access Extend/Uninstall.

Just noting here for reference.

[edited for clarity]

mpp’s picture

yepa’s picture

Thanks for your patch #3 @labboy0276.
It works fine on barrio 4.22, Drupal 8.6.13 with layout builder and without Display suite ;)

OCTOGONE.dev’s picture

Greetings, personally i had Barrio activated in my themes but it was not the default theme and the defaut theme was'nt a subtheme of barrio and layout builder was bugging.

I was unable to add a section (spinners next to "add section" was active a 1 second and then nothing, no side panel). But i was able to add blocks. It was hard for me to find what caused the bug. After i've uninstalled barrio theme, i was able to add sections with layout builder.

Greenman77’s picture

Thank you, patch worked a treat with Drupal 8.7 layout builder enabled.

ergophobe’s picture

Just to provide a link for Layout Builder Restrictions - https://www.drupal.org/project/layout_builder_restrictions

That worked fine. I'm not sure which is better. On the one hand, using the module means no patch to maintain and track.

On the other, if the patch in #3 is applied, it's probably easier to roll back than LBR settings, since you would just have to remove the patch from composer.json and run a composer update.

Joachim Namyslo’s picture

Ok just to catch developers again. The Bootstrap Bario Distribution utilizes DS with is a contrib module.

Without DS installed the Layout Builder will not work when Barrio or any subtheme based on it is enabled because it looks for a class provided by display suite.

So Is there any concern about removing the display suite classes from barrio entirely to make sure Barrio and relying on sub-themes will work out of the box with layout builder instead of display suite?

What prevents you from merging this patch into next release or even to the current one?

Without patch adding a section to layout builder on content, type fails.
With patch applied layout builder works like a charm

In my opinion, this patch should be applied already to not force users to fix this bug if they like to use a layout builder by applying a working patch manually.

We can do it manually but it is not as hard and as time consuming as some of us may thought to apply a git patch to a repository just to fix this bug. The code is allready written.

qpro’s picture

patch works for me too.
In my case layout builder and twig make the use of display suite not necessary (great module anyway).

ivnish’s picture

Patch #3 works for me, thanks

mrupsidown’s picture

#3 works for me too. Seems like a legitimate merge. Why is it not yet in the current release?

Joachim Namyslo’s picture

I am not sure, if Card layout is broken by now. buth with pach #3 applied the Card layout doens't work anymore. So it may be a grat Ideato check if patch #3 is the reason for this. If not. you should aply it I've tested it and the Problem goes way like a charm.

brandonratz’s picture

Yet another module gaining popularity is Layout Builder Libraries (layout_library). Layout Builder Restrictions (layout_builder_restrictions) only restricts layouts on Entities which manage layouts. A Layout Library doesn't use the same forms and restrictions won't be applicable. Therefore, creating any Layout from this module's functionality will fail because it allows all layouts to be used when creating a new library entry.

In summary, using patch from #3 works as a fix for layout_library. Not using Display Suite.

backnforth’s picture

I applied patch #3 and disabled display suite, but when I edit the layout for either my content type or for an individual content, I'm not able to save or cancel layouts.

acnimda’s picture

Patch #3 is working here like a charm.
With git git apply -v layout_builder.patcherrors occurred.

error: patch failed: bootstrap_barrio.layouts.yml:2
error: bootstrap_barrio.layouts.yml: patch does not apply

the working solution for me was
patch -p1 < layout_builder.patch

TLTHades’s picture

hswong3i’s picture

Could we simply rename the bootstrap_barrio.layouts.yml as bootstrap_barrio.layouts.yml.sample, so when someone really need it then enable it manually?

Status: Needs review » Needs work
dariogcode’s picture

Patch #3 works but those layouts aren't available to use (still appear) but when added show wrong markup.

Volker23’s picture

Patch in #38 worked for me. Until now with no further hiccups. Thanks!

dmducc’s picture

EDIT: maybe I was wrong about what I posted

marcoka’s picture

Still valid, Took me an hour to find out what completely kills layoutmanager, major bug.

Sivaji_Ganesh_Jojodae’s picture

FileSize
23.1 KB
25.53 KB

Without Display Suite the patch #3 allows to use some of the layouts however for cards & media layout it breaks as in the screenshots for me.

The patch #38 already seems applied in the latest version.

hatuhay’s picture

Status: Needs work » Closed (duplicate)
Related issues: +#3118909: Layout Builder broken with Bario
hatuhay’s picture

Status: Closed (duplicate) » Closed (won't fix)

Since november in dev and next stable release (hope in a week) the layout will be on subtheme.
In another stable release (I expect in a couple of months) the file will be there but rename so it will not be picked by default.
Making this change right away will destroy current sites, imposible to simply delete.
I will add a note on actual them page, to try new installations to avoid using this featrure directly..
Ideally this change should be done on a higher version,but as version respects Bootstrap version this cannot be done.
The class can be changed by any valid layout class as bootatrap_layouts or layouts, but unfortunadly the them cannot declare them.

brooke_heaton’s picture

Wow, this is definitely an issue and is breaking my use of Layout Builder with bootstrap_barrio.

FiNeX’s picture

Hi, does exists a temporary workaround until a new version will be released? thank you :-)

Bessonweb’s picture

Same here. It would be nice to resolve this issue.

jurgenhaas’s picture

@FiNeX and @Bessonweb I'm using the patch from #38 successfully in a composer based Drupal installation.

FiNeX’s picture

@jurgenhaas: thank you for the suggestion, I will try :-)

hatuhay’s picture

@jurgenhaas note on main Barrio page.

ashrafabed’s picture

Another approach to solving this problem could be requiring the DS module as a dependency of the theme.

That was not possible until Drupal 8.9 (yet to be released), however, when 8.9 comes out it will be supported: https://www.drupal.org/project/drupal/issues/474684

When that happens, a patch such as the one I am attaching now could be a viable solution.

This patch should not be applied until Drupal 8.9 is released.

This patch is being submitted as part of a training class at https://DebugAcademy.com .

ashrafabed’s picture

Status: Closed (won't fix) » Postponed

Marking the issue as "postponed" in anticipation of Drupal 8.9 supporting themes having dependencies on modules.

jurgenhaas’s picture

@ashrafabed, the problem with that approach is that one has to enable display suite. But what if I wanted to use this theme without DS? I think that's what this issue is all about.

To combine barrio with DS, I think a helper module should be created which declares both the dependencies and the layouts. And the use of that helper module is then optional.

hatuhay’s picture

I agree @jurgenhass,
We will go for a helper module that will store and declare the Barrio specific layouts.

ashrafabed’s picture

That makes sense to me, I agree with moving it to a helper module.

jurgenhaas’s picture

@hatuhay just wanted to clarify, that barrio specific layouts should remain in the theme. Only parts that depend on DS should be moved out of it

yusufhm’s picture

Status: Postponed » Needs review
FileSize
1.57 KB

Since we've agreed to move the DS Layouts to a helper module, I've created a patch to remove it here.

dravenk’s picture

As https://www.drupal.org/project/bootstrap_barrio/issues/2976934#comment-1... said. The templates/ds defined in the layouts should also be moved out of the helper module.

hatuhay’s picture

Status: Needs review » Fixed

Created a new module only for the handler library, the layouts remain on the theme.
A potencial issue with custom DS classes, not sure if used to much, but can cause trouble.
Eventhough Bootstrap Barrio Extras module is working out of the box, still needs some testing.
This fix already on dev, I expect to issue new version once Drupal 8.9/9 are launched.

  • hatuhay committed 489d7a9 on 8.x-4.x
    Issue #2976934 by dravenk, labboy0276, ashrafabed, hswong3i, yusufhm,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

jeffaxelrod’s picture

Just ran into this issue with Bootstrap Barrio; status shows fixed. What am I missing?

Drupal\Component\Plugin\Exception\PluginException: Plugin (bb_cardbasic) instance class "Drupal\ds\Plugin\DsLayout" does not exist. in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (line 97 of /home/public/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php).

hatuhay’s picture

This issue is documented on the main page of the site due to its importance.
There two dev versions now:

  • 8.x-4.x-dev, still carries the error and wil be 8.29 once fully tested, there you should apply patch
  • 5.x-dev, gets rid of semi DS dependency and relies on core layout_discovery API, but if using DS layouts then old layourts must be mannually copy to subtheme. This version is already pushed to Drupal repo.
lawxen’s picture

@hatuhay I see the issue has been commited to 8.x-4.x, so which patch should we apply

hatuhay’s picture

@lawxen
Upgrade to 5.0.0.
If using Display Suite follow upgrade notes

Greenman77’s picture

Upgraded to 5 and as per "upgrade notes" there is no templates/ds in this version. I also noticed a comment to say it should be moved to a helper class #60 so thought it may have been removed as a result. Installed extras but no luck here either.

I note that my error may not be related and my install works without having layout styles installed (unfortunately I need it) issue may have to go back to styles. Still, symptoms seemed to be very similar to an old barrio issue I had and was able to fix with a patch to do with ds.

Clicking add section and then choosing the layout from the list results in the following error.

Error: Call to undefined method Drupal\layout_builder\Form\ConfigureSectionForm::getLayout() in layout_builder_styles_form_layout_builder_configure_section_alter() (line 95 of /var/www/html/web/modules/contrib/layout_builder_styles/layout_builder_styles.module)

Drupal Core 8.9.7
Barrio 5.1.4
Display Suite 8.x-3.9
Layout Builder Restrictions 8.x-2.7
Layout Styles 8.x-1.0-beta2

Greenman77’s picture

Further to my previous it now seems like it's not related and specific to Barrio also happening when switching to Bartik so I'll take it to the Layout Builder Styles project issue queue.