Categories categorisableMultiSelection choice per registered property name
| Q | A |
|---|---|
| ModuleStudio Version | [1.4.0] |
| Operating System | [Windows] |
| Zikula Target in Model | [ZK20] |
| Zikula Version | [2.0.x] |
| PHP Version | [7.0.x] |
Summary MOST allows to active categorisableMultiSelection per entity = all categories of an entity show either the single or the multi selection feature. When more than one category properties are registered for a module in Categories / category registry, some of them might need to work with SingleSelection, which is not possible in the current situation.
Desired Behavior Allow to chose between single and multi selection per category property.
Possible Solution Move the option categorisableMultiSelection to the category registry of the Categories module
Note: the generated CategoryHelper already provides a hasMultipleSelection method which allows to decide for each entity and property/registry whether multi selection should be possible or not.
I see "public function hasMultipleSelection" in AbstractCategoryHelper.php. I would need an example of how a "Subclass can override this method to apply a custom behaviour to certain category registries"
I'll first need to verify that this is properly considered at all places, e.g. quick navigation form type and other form types.
Example for overriding the method:
public function hasMultipleSelection($objectType = '', $registry = '')
{
if ('person' === $objectType) {
return 'MySpecial' === $registry;
}
return parent::hasMultipleSelection($objectType, $registry);
}
This would enable the multi selection for the MySpecial registry, but not for other ones registered for the same entity (person).
But it won't work at all places yet, because there are some more changes required in the form classes and/or the categories form type in the core.