Hi devs,
I’d like to propose to introduce the concept of hidden macros.
Rationale and use cases:
- Some extensions introduce internal macros (that they use on several pages, usually as a way to reuse code). They are not supposed to be visible in the list of macros in the WYSIWYG editor.
- If you’re a wiki admin you may want to direct your users to use a specific macro for a purpose (say to make graphs) but you also want to use an extension that draws another macro to make graphs but you don’t want your users to use that one.
Proposal 1
- Add a “hidden” field to the Macro descriptor
- Similar to the macro descriptor category, allow users to override this field from the configuration
#-# [Since 2.0M3] #-# Overrides default macro categories (Each macro has a default category already defined, for example #-# "presentation" for the Table of Contents Macro). #-# #-# Ex: To redefine the macro category for the TOC macro so that it'd be in the "My Category" category + #-# redefine the category for the Script Macro to be "My Other Category", you'd use: # rendering.macroCategories = toc:My Category # rendering.macroCategories = script:My Other Category
- Also provide an Admin UI to set this configuration
- Add a java
ConfigurationSource
to return the information (i.e. introduce aMacroDescriptorConfig
wiki page to hold that info + fallback toxwiki.properties
. Maybe also fallback to the main wiki’sMacroDescriptorConfig
) - Modify the WYSIWYG backend service to not return hidden macros
- Modify
XWikiSyntaxMacrosList
to not return hidden macros - Option: show the hidden macros if the user is showing hidden pages in his profile
Proposal 2
- Deprecate
getDefaultCategory()
in theMacroDescriptor
in favor ofgetDefaultCategories()
, i.e. allow having several categories + change thexwiki.properties
rendering.macroCategories
config to support several categories - Introduce a UI + java Configuration Source to configure the macro category override
- Introduce a “hidden” category
- Modify the WYSIWYG backend service to not return hidden macros
- Modify
XWikiSyntaxMacrosList
to not return hidden macros - Option: show the hidden macros if the user is showing hidden pages in his profile
In short proposal 2 is the same as 1 but reusing the existing “category” concept (that is extended to support several categories), making the “hidden” category a special name/concept vs other categories.
Note: We could also introduce a new configuration in xwiki.properties
(and possibly UI) to control whether hidden macros are never shown or shown depending on the user’s “show hidden pages”. I’d say that could be added later if need be.
WDYT?
My preference goes towards proposal 2 since:
- It can be made backward compatible IMO
- We kill 2 birds with one stone, i.e. we implement the concept of hidden macros while adding the new feature of being able to have several categories for macros.
- We improve configurability of categories override by providing a UI for it.
Thanks