Action just for content with rich text [SOLVED]

Is it possible to register an action just for content that has rich text (behaviour) ?

Can't you add that as a python-expression condition on the object/context?

You can check for interfaces with a helper view in a python expression like this:

python: context.restrictedTraverse('@@plone_interface_info').provides('project.content.ct.IMyCTInterface')

Maybe the @@plone_interface_info view could/should be extended to support short hand behavior names. But I'm not sure how that works with the rewrite of behavior identifiers from last year where plone.app.contenttypes.behaviors.richtext.IRichText has become plone.richtext.

As @fredvd says :wink:

This seems to work in Plone 5.2.1

python:context.restrictedTraverse('@@plone_interface_info').provides('plone.app.contenttypes.behaviors.richtext.IRichText')

You have to use the interface's dotted name, not the shortname plone.richtext

See https://docs.plone.org/develop/addons/components/interfaces.html#plone-interface-info
and https://docs.plone.org/external/plone.app.dexterity/docs/reference/standard-behaviours.html

Super… thanks everyone.

I registered the 'view' of the action

for="plone.app.contenttypes.behaviors.richtext.IRichText"

And put the condition on the Action:

python:context.restrictedTraverse('@@plone_interface_info').provides('plone.app.contenttypes.behaviors.richtext.IRichText')

So now the action can not be called by url, and it is just present in the toolbar for rich text content