I'm using the following observer to add the editor
handle to a System > Configuration section:
Partial config.xml
:
<adminhtml>
<!-- Events -->
<events>
<!-- Triggered before layout load -->
<controller_action_layout_load_before>
<observers>
<digitalpianism_test_controller_action_layout_load_before>
<type>singleton</type>
<class>test/admin_observer</class>
<method>addEditorHandle</method>
</digitalpianism_test_controller_action_layout_load_before>
</observers>
</controller_action_layout_load_before>
</events>
</adminhtml>
Then my Admin/Observer.php
file looks like this:
class DigitalPianism_Wall2time_Model_Admin_Observer
{
/**
* Add the editor handle to the system configuration Test section
* @param Varien_Event_Observer $observer
*/
public function addEditorHandle(Varien_Event_Observer $observer)
{
$layout = $observer->getEvent()->getLayout();
$params = $observer->getAction()->getRequest()->getParams();
// We add the editor handle when viewing the section where the chooser widget is displayed
if (array_key_exists('section',$params) && $params['section'] == "test")
{
$layout->getUpdate()->addHandle('editor');
}
}
}
That works perfectly fine as a full administrator, I can use the editor handle to use widget in that specific section of my module.
However, if I use an user with a role limited to the System > Configuration > Test section only, I get the following error in the JS console:
ReferenceError: WysiwygWidget is not defined
When I check the resources loaded, I find that the mage/adminhtml/wysiwyg/widget.js
is not getting loaded from the editor
handle, I assume it has something to do with the resources I assigned to my user role but I can't find which ACL is related to this specific editor
handle.
NB: user allowed with another configuration section allowed access won't face the problem, it only happens if the user can only access the System > Configuration > Test section.
<remove>
elements:<remove name="BLOCKNAME" acl="RESOURCE" />
only removes the block if the user has permissions for RESOURCE. But the remove tag seems to be the only one and has nothing to do with the editor handle.