I created a custom category multiselect attribute. (it's even a custom source but that does not matter).
Everything is OK on save, admin forms OK, even the flat contains my values. ( thx to https://github.com/magento/magento2/issues/417 )
BUT, when i do a list/get on front through repository, my category object does not have the values... (flat is activated)
I found an event in
// Allow extensions to modify select (e.g. add custom category attributes to select) $this->_eventManager->dispatch('catalog_category_flat_loadnodes_before', ['select' => $select]);
- Is that the only way ? It seems weird to me when i think about the XML of Magento 1.
- Do i have to modify anything else ?
edit: Even with flat disabled, i can't get it...
edit2: ok, i'm stupid. A part of the problem was because i was in
canShow , and it uses a "hard coded" collection through the
getCategoryTree function . Hooray, another plugin to write. The funny thing is that i know have a string instead of an array through get. As if the afterLoad was not called... Another mystery...
But then... the observer i gave. What is its purpose ?