» userreference_explorer realized as nodereference_explorer plugin
Component:
Code
» Nodereference Explorer Plugins
This should be realizable with minor efford as the "nodereference explorer plugins" take care of the differences between the underlying CCK fields. Currently the link field is supported and the peciluarties of the nodereference field have been extracted. That's how this initial architecture emerged.
Here's is a short guide. The plugins are located in the module's "plugins" folder. You can find "nodereference" and "link" in the same named folders of the cck subdirectory. A new CCK plugin requires:
1. (Optional) A new subfolder in the cck directory, e. g. "userreference".
2. An include class with the naming convention nodereference_explorer_plugin_cck_{field_name} extending the class nodereference_explorer_plugin_cck, e. g. nodereference_explorer_plugin_cck_userreference. Have a look at the super class which methods this class inherits and has to implement. These methods handle the widget rendering, theming and widget settings. Correctly created the CCK field gets an additional Explorer widget.
3. A JS file including two methods with the naming convention nodereference_explorer_plugin_cck_{field_name}_setValue nodereference_explorer_plugin_cck_{field_name}_removeValue. These function handle the storing of the selected value to the parent widget.
As the anatomy of userreference and nodereference are pretty similar, it should be possible to just copy the nodereference folder and files and refactor/rename everything from "nodereference" to "userreference".
I'd be glad if someone could try this and submit a patch.
Comments
Comment #1
gnindl commentedThis should be realizable with minor efford as the "nodereference explorer plugins" take care of the differences between the underlying CCK fields. Currently the link field is supported and the peciluarties of the nodereference field have been extracted. That's how this initial architecture emerged.
Here's is a short guide. The plugins are located in the module's "plugins" folder. You can find "nodereference" and "link" in the same named folders of the cck subdirectory. A new CCK plugin requires:
1. (Optional) A new subfolder in the cck directory, e. g. "userreference".
2. An include class with the naming convention nodereference_explorer_plugin_cck_{field_name} extending the class nodereference_explorer_plugin_cck, e. g. nodereference_explorer_plugin_cck_userreference. Have a look at the super class which methods this class inherits and has to implement. These methods handle the widget rendering, theming and widget settings. Correctly created the CCK field gets an additional Explorer widget.
3. A JS file including two methods with the naming convention nodereference_explorer_plugin_cck_{field_name}_setValue nodereference_explorer_plugin_cck_{field_name}_removeValue. These function handle the storing of the selected value to the parent widget.
As the anatomy of userreference and nodereference are pretty similar, it should be possible to just copy the nodereference folder and files and refactor/rename everything from "nodereference" to "userreference".
I'd be glad if someone could try this and submit a patch.
Comment #2
gnindl commentedPlugin architecture needs documentation and be more generic
Comment #3
gnindl commentedPropagated to explorer module - supposed to have more generic architecture.