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

icon resolver summarized issues #3500

Open
2 of 5 tasks
agitator opened this issue Apr 12, 2022 · 8 comments
Open
2 of 5 tasks

icon resolver summarized issues #3500

agitator opened this issue Apr 12, 2022 · 8 comments

Comments

@agitator
Copy link
Member

agitator commented Apr 12, 2022

How it is expected to work:

  • Icons are registered by name via registry in staticresources
  • each icon name will return the path to the resource
  • the iconresolver tag method, will return a parametrized (class, aria) svg snippet that you can inline in your template
  • icon names containing a / support fallback to a more generic icon, for example contenttype/foo will return the default contenttype
  • the icon_expr property within the fti or actions should be used for the context specific lookup of an icon
  • the icon resolver will return a plone icon as the last option if no icon lookup is possible, this should NOT happen

Open Issues for icon resolver:

@agitator
Copy link
Member Author

agitator commented Apr 28, 2022

Regarding plone/mockup#1159 (comment) and reading https://docs.plone.org/develop/plone/searching_and_indexing/indexing.html#default-plone-indexes-and-metadata-columns ... should we rethink what we do with getIcon?
@mauritsvanrees @jensens @ale-rt @petschki @MrTango

@petschki
Copy link
Member

+1000

what about a catalog metadata content_icon or type_icon which contains the registry key for the icon. this would make it easy for the folder_contents to get the correct icons

@agitator
Copy link
Member Author

Products/CMFCore/DynamicType.py seems to return the icon_exprvalue

(Pdb++) self.context.getIconURL()
'contenttype/document'

Is that enough?

@petschki
Copy link
Member

yes, that's what the @@iconresolver expects

@yurj
Copy link
Contributor

yurj commented Apr 28, 2022

Something in the metadata but not in the index... Anyway I would not change it because it can be used. What is the purpose of using the catalog? We just need a map from the content type to the icon string (as above), something like:

{'Document': 'contenttype/document',
 'Image': 'contenttype/image',
...
}

This can be built on startup querying the registry and cached?

@petschki
Copy link
Member

for example pat-structure gets the item info via plone.app.vocabularies.Catalog ... if you make a mapping, you have to read the map in mockup and use it with a utility etc... catalog metadata would be much simpler as the data is simply there, where you need it.

@yurj
Copy link
Contributor

yurj commented Apr 28, 2022

What about then to add the content type icons on a vocabulary typeIcons and get them with '/@@getVocabulary?name=plone.app.vocabularies.typeIcons'? This can be also cached in the browser and reused by Volto. For example, how Volto get the icon in folder contents?

@jensens
Copy link
Member

jensens commented Apr 29, 2022

As long as the vocabulary is not defined in plone.app.vocabularies (otherwise dependency indirection), but in CMFPlone I am fine if it helps.

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

6 participants