Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#60 | interdiff-59-60.txt | 6.38 KB | dravenk |
#60 | ds-layouts-break-2976934-60.patch | 7.96 KB | dravenk |
| |||
#59 | ds-layouts-break-2976934-59.patch | 1.57 KB | yusufhm |
| |||
#44 | Selection_008.png | 25.53 KB | Sivaji_Ganesh_Jojodae |
#44 | Selection_007.png | 23.1 KB | Sivaji_Ganesh_Jojodae |
Comments
Comment #2
labboy0276 CreditAttribution: labboy0276 commentedComment #3
labboy0276 CreditAttribution: labboy0276 at Tandem commentedHere is the patch
Comment #4
hatuhay CreditAttribution: hatuhay commentedThanks for your report and patch.
I will sleep on this because right now I have no clue.
Comment #5
labboy0276 CreditAttribution: labboy0276 commentedYou could revise the layout so they are not DS dependent. Not sure why you did it that way, but that is my best guess.
Comment #6
hatuhay CreditAttribution: hatuhay commentedStill 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.
Comment #7
candelas CreditAttribution: candelas commentedHello
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
Comment #8
alexrayu CreditAttribution: alexrayu as a volunteer commentedEncountered the same issue. If the theme requires DS, it should be a correct requirement in the info.yml file.
Comment #9
alexrayu CreditAttribution: alexrayu as a volunteer commentedSeems 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
Comment #10
alexrayu CreditAttribution: alexrayu as a volunteer commented@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?
Comment #11
hctomJust 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.
Comment #12
hctomAccidentally added my last comment line to the issue body ;)
Comment #13
hatuhay CreditAttribution: hatuhay commentedIf 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.
Comment #14
pclaitte CreditAttribution: pclaitte as a volunteer and commentedWhy 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
Comment #15
labboy0276 CreditAttribution: labboy0276 at Tandem commentedThe 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?
Comment #16
pclaitte CreditAttribution: pclaitte as a volunteer and commentedI have tried the module layout_builder_restriction. It works for me.
Thanks @labboy0276
Comment #17
andypostComment #19
andypostHheme could use hook layout discovery to inject DS classes if module ds is enabled or define dependency on module
Comment #20
MLZRI 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
Comment #21
playful CreditAttribution: playful commentedIs 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.
Comment #22
labboy0276 CreditAttribution: labboy0276 at Tandem commented@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.
Comment #23
jweirather CreditAttribution: jweirather commentedI'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]
Comment #24
mpp CreditAttribution: mpp at District09 for District09 commentedSee https://www.drupal.org/project/drupal/issues/1846070 for an improved error message.
Comment #25
yepaThanks for your patch #3 @labboy0276.
It works fine on barrio 4.22, Drupal 8.6.13 with layout builder and without Display suite ;)
Comment #26
OCTOGONE.dev CreditAttribution: OCTOGONE.dev commentedGreetings, 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.
Comment #27
Greenman77 CreditAttribution: Greenman77 commentedThank you, patch worked a treat with Drupal 8.7 layout builder enabled.
Comment #28
ergophobe CreditAttribution: ergophobe commentedJust 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.
Comment #29
Joachim NamysloOk 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.
Comment #30
qpropatch works for me too.
In my case layout builder and twig make the use of display suite not necessary (great module anyway).
Comment #31
ivnish CreditAttribution: ivnish commentedPatch #3 works for me, thanks
Comment #32
mrupsidown CreditAttribution: mrupsidown commented#3 works for me too. Seems like a legitimate merge. Why is it not yet in the current release?
Comment #33
Joachim NamysloI 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.
Comment #34
brandonratz CreditAttribution: brandonratz as a volunteer commentedYet 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.
Comment #35
backnforth CreditAttribution: backnforth commentedI 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.
Comment #36
acnimda CreditAttribution: acnimda as a volunteer commentedPatch #3 is working here like a charm.
With git
git apply -v layout_builder.patch
errors occurred.the working solution for me was
patch -p1 < layout_builder.patch
Comment #37
TLTHades CreditAttribution: TLTHades commentedThank! Patch №3, helped me solve this problem
https://www.drupal.org/forum/support/post-installation/2019-05-01/unable...
Comment #38
hswong3i CreditAttribution: hswong3i commentedCould we simply rename the
bootstrap_barrio.layouts.yml
asbootstrap_barrio.layouts.yml.sample
, so when someone really need it then enable it manually?Comment #40
dariogcode CreditAttribution: dariogcode commentedPatch #3 works but those layouts aren't available to use (still appear) but when added show wrong markup.
Comment #41
Volker23 CreditAttribution: Volker23 as a volunteer commentedPatch in #38 worked for me. Until now with no further hiccups. Thanks!
Comment #42
dmducc CreditAttribution: dmducc commentedEDIT: maybe I was wrong about what I posted
Comment #43
marcoka CreditAttribution: marcoka commentedStill valid, Took me an hour to find out what completely kills layoutmanager, major bug.
Comment #44
Sivaji_Ganesh_Jojodae CreditAttribution: Sivaji_Ganesh_Jojodae as a volunteer and commentedWithout 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.
Comment #45
hatuhay CreditAttribution: hatuhay commentedComment #46
hatuhay CreditAttribution: hatuhay commentedSince 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.
Comment #47
brooke_heaton CreditAttribution: brooke_heaton as a volunteer commentedWow, this is definitely an issue and is breaking my use of Layout Builder with bootstrap_barrio.
Comment #48
FiNeX CreditAttribution: FiNeX as a volunteer commentedHi, does exists a temporary workaround until a new version will be released? thank you :-)
Comment #49
Bessonweb CreditAttribution: Bessonweb commentedSame here. It would be nice to resolve this issue.
Comment #50
jurgenhaas@FiNeX and @Bessonweb I'm using the patch from #38 successfully in a composer based Drupal installation.
Comment #51
FiNeX CreditAttribution: FiNeX as a volunteer commented@jurgenhaas: thank you for the suggestion, I will try :-)
Comment #52
hatuhay CreditAttribution: hatuhay commented@jurgenhaas note on main Barrio page.
Comment #53
ashrafabedAnother 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 .
Comment #54
ashrafabedMarking the issue as "postponed" in anticipation of Drupal 8.9 supporting themes having dependencies on modules.
Comment #55
jurgenhaas@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.
Comment #56
hatuhay CreditAttribution: hatuhay commentedI agree @jurgenhass,
We will go for a helper module that will store and declare the Barrio specific layouts.
Comment #57
ashrafabedThat makes sense to me, I agree with moving it to a helper module.
Comment #58
jurgenhaas@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
Comment #59
yusufhmSince we've agreed to move the DS Layouts to a helper module, I've created a patch to remove it here.
Comment #60
dravenkAs 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.
Comment #61
hatuhay CreditAttribution: hatuhay commentedCreated 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.
Comment #64
jeffaxelrod CreditAttribution: jeffaxelrod as a volunteer and commentedJust 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).
Comment #65
hatuhay CreditAttribution: hatuhay commentedThis issue is documented on the main page of the site due to its importance.
There two dev versions now:
Comment #66
lawxen CreditAttribution: lawxen commented@hatuhay I see the issue has been commited to 8.x-4.x, so which patch should we apply
Comment #67
hatuhay CreditAttribution: hatuhay commented@lawxen
Upgrade to 5.0.0.
If using Display Suite follow upgrade notes
Comment #68
Greenman77 CreditAttribution: Greenman77 commentedUpgraded 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
Comment #69
Greenman77 CreditAttribution: Greenman77 commentedFurther 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.