localgov
localgov copied to clipboard
Limit the type of page component types available from a service page, with documentation for those that remain
When creating a service page, there is a "page components" field at the bottom.
This currently allows a huge numebr of paragraphs.
I think this was originally intended for a couple of reusable paragraph components.
@Adnan-cds @cjstevens78 @willguv do you know what the intended paragraph components are?
do you know what the intended paragraph components are?
Sorry Finn, I don't know really. There is no restriction on this field in the Croydon site at the moment. I am copying Tom in case he has any thoughts. @tom-steel
Perhaps we can consult editors. Copying @benhillsjones. Ben, any opinion about what Page component types you would ever want to use in Service pages?
Thanks @Adnan-cds ! I assume that "Fact box" and "Contact" are of potential use, being things that you might want to change in one place and update in multiple. The others I am less sure of.
Just discussing this with @Adnan-cds
Just confirming that we've seen the following paragraph components in use on Croydon:
- Documents
- Link
- Link and summary
- Contact
So perhaps we limit the component field on the entity browser to the above for a default install.
Yes definitely in favour of this, thanks for pursuing @finnlewis
I’ll send @benhillsjones a link to this chat as he may not have seen it
Hi, yes agree those 4 make sense, main two I use are links and contacts
Plus documents when at Croydon
This is still a live issue on fresh install.
@andybroomfield I've added this to the kanban the content group has started using to discuss these kind of issues. Thanks for flagging
It's a bug in paragraphs, which ignore the add to library setting. See https://www.drupal.org/project/paragraphs/issues/3090101 (Patch applied to BHCC site).
@finnlewis this feels like an important issue that could be fixed quickly so am prioritising
Closed a duplicate issue and gave this a better title
@stephen-cox the consensus seems to be what @finnlewis outlined above
Just confirming that we've seen the following paragraph components in use on Croydon:
Documents Link Link and summary Contact
Do you agree? Can you estimate this please? Many thanks
@willguv As this just refers the types of page components that can be created, the list seems sensible to me.
Unfortunately this is not as simple as it should be. It would be nice if this was just a matter of configuring the available types, but this is not possible with the Paragraphs Library. There's an issues for it which doesn't offer much in the way of a solution: https://www.drupal.org/project/paragraphs/issues/2975831
This means we'll need to change the list of paragraph types in a hook, to change either the form or the widget. Rather than hard coding the list of available types I would also suggest creating an admin page where this can be set on a site by site basis, so a form and settings for this will be needed as well.
It's not a large job, but certainly not quick.
Do you have a page at /admin/config/content/paragraphs_library_item There is a patch I listed above that enables settings here for what paragraphs can appear here.

There is a patch I listed above that enables settings here for what paragraphs can appear here.
I missed that. A patch adding this functionality make this a much quicker job :smile:
@stephen-cox can this patch be safely enabled for everyone? Thanks
The patch would apply to all installs, but we only have to apply the config for new installs. As it does create new config there's a slight risk that the schema will change and we'll have to write update hooks to fix it.
@stephen-cox to discuss at the Tech Group or can we talk about it here?
@finnlewis @ekes There's a patch on this issue (https://www.drupal.org/project/paragraphs/issues/3090101) that allows us to limit the paragraph types available to page components.
My concern is that this adds new config that we'll end up having to support if Paragraphs decides to do things differently.
Any thoughts on this?
Note to self: paragraphs library does not support restricting paragraph types. The patch addresses this.
Plus one from me to test and review closer.
Hi @finnlewis the long list of paragraph types (and lack of docs) came up at LGD Camp
Were you able to review the patch? Cheers
@ekes want to write up your latest research or link to it?
Also see https://github.com/localgovdrupal/localgov/issues/746
You should have the option to limit it on this page /admin/config/content/paragraphs_library_item Configuration -> Content authoring -> Paragraphs library item settings
You should have the option to limit it on this page /admin/config/content/paragraphs_library_item
Works if all the fields are going to be restricted to the same library items. Maybe good enough? Are there reusable items that you would want in one place on a site, but not in another?
I'll write all this up more systematically, but also for the field in question on the service page. This in not a paragraphs (Entity Revisions Reference field) it is an Entity Reference field restricted to pointing to Paragraphs Library Items. So this field will only have reusable items in it, no single-use paragraphs, and will hence only have the paragraph types listed on /admin/config/content/paragraphs_library_item