How to modify the structure mockup pattern?

After an accessibility check that a client run on her website, we are required to do some modifications on Plone's templates including the "folder contents" view.

There Plone is using the "structure" pattern from mockup to show the folder contents view, and specificaly we were requested to remove the last <ul> item because it is not a real list and convert it to some other HTML tag, this line: https://github.com/plone/mockup/blob/master/mockup/patterns/structure/templates/paging.xml#L45

How should we face it?

I tried to create a different pattern (a shameless copy of structure pattern), register it as a new one, change the folder contents template to call the new pattern, but I don't manage to register the pattern correctly. The point seems that the structure pattern uses a "mockup-patterns-structure-url" "pattern" to point to a given folder in the mockup project and then the pattern loads the needed files (among others the paging.xml we want to change) from there.

Checking Plone's config.js generator I see that when registering the pattern in my registry.xml file I can use a "url" indicator to register the "mockup-patterns-mystructure-url", anyway I don't manage to load the pattern correctly.

Is this the right direction?

Any other hint will be appreciated :slight_smile:

Fix it in mockup!

Will do! PR is already in place: https://github.com/plone/mockup/pull/949

Thanks,

Now I will try to create a plone.staticresources package build with the updated pattern to install it on the site.

1 Like

I'd be interested to know how would this should be done if the proper answer wasn't "fix it in mockup"....

as a general principle for overriding this pattern....

:slight_smile:

I tried to understand if/how it would be possible to override/customize the structure pattern, but failed.
My goal is to reintroduce the add menu buttons, removed back in 2015: my instance does not show the standard Plone toolbar, so I'm looking for an alternative way to allow adding new contents from within the folder_contents view.

As @djowett said, it would be nice to have some hint on how to customize the pattern... without touching upstream source :smirk:

Did anyone manage to figure out how to override a pattern?

@erral @lelit @djowett @thet

Wesley Barroso Lopes via Plone Community community@plone.org writes:

Did anyone manage to figure out how to override a pattern?

Not me :-\

Nope.

In Plone 5 with RequireJS you can do it like so:

In Plone 6 with ES6 and current Patternslib it's different. You cannot overwrite resources as with Plone 5.2 because there are no such registrations at all (which is a good thing except for the missing overwritability).
You can subclass a pattern. But then you have to provide a different name, because the pattern is already registered by just importing it.
I'm thinking forth and back, if this is a good thing or not. It's convenient, but it's also limiting. We could also bypass that with some Patternslib registry API methods to overwrite existing Pattern registrations.
Since such customizations are a valid use case in Plone I will come up with something.

But I guess you were referring to Plone 5, right?

/cc @wesleybl @lelit @erral

3 Likes

Yes I was talking about Plone 5. I will try that. Thank you!