Limit prev/next functionality to certain content types?

What's the best way to limit the prev/next functionality to certain content types?
For example Page, Event, News but not to show Images and Files

In the Dexterity controlpanel you can configure the Next previous navigation behavior by type.

I want to limit the content types that appear as next/prev inside the item that has that behavior

There are 2 similar behaviors: one is Next previous navigation toggle, responsible for adding the respective boolean field to the Settings fieldset. And then there's the one I mentioned above, which should get the job done but I tested and didn't notice any effect.

Yes there are two settings/behaviors

My folderish type has these settings:

Image has these settings:

I want to prevent that an Image shows as a next/prev link, these settings don't help for that.
Any other ideas?

Sorry, I had misunderstood the behaviors. They only differ in that one applies to all items from a content-type and the other adds a toggle for individual items. Btw I suggest neither should be available for non-containers (i.e. 6/8 native types) as they have no effect and just add confusion.

To filter which types can be accessed inside next/previous viewlet, you have to either monkeypatch or overwrite this adapter: replacing its base class init call from context.getOrdering to something like: [ for o in self.context.objectValues() if o.portal_type not in ['Image']]

Better yet, we could improve the viewlet to make it follow the settings from @@navigation-controlpanel. That way all users would have that configurable TTW.

That did the trick, thanx!
Not sure about using the settings from @@navigation-controlpanel, in my case those types are quite different.

Patching for now :wink:

1 Like