Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

News portlet only search for "News item" portal type #86

Open
keul opened this issue Sep 8, 2016 · 3 comments
Open

News portlet only search for "News item" portal type #86

keul opened this issue Sep 8, 2016 · 3 comments

Comments

@keul
Copy link
Member

keul commented Sep 8, 2016

The news portlet performs a search on basic Plone news using "News Item" portal type:

return catalog(portal_type='News Item',

I'm wondering if we can use the INewsItem interface here. My usecase is a custom add-on that added a new "News" that extends the INewsItem.
If this lead to side effects I think we can add type selection here (with a default to "News Item").

@davilima6
Copy link
Member

davilima6 commented Sep 8, 2016

+1 but I'd suggest type selection widget to be displayed only when there are more than one enabled content types providing INewsItem, so that users don't see useless UI.

@keul
Copy link
Member Author

keul commented Sep 8, 2016

@davilima6 would be nice. I'm wondering if will simple to know which content types implements an interface.

@davilima6
Copy link
Member

davilima6 commented Sep 8, 2016

Something like this should work:

from plone.dexterity.utils import resolveDottedName
news_types = [type.id for type in api.portal.get_tool(name='portal_types').values() if hasattr(type, 'klass') and INewsItem.implementedBy(resolveDottedName(type.klass))]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants