I am working on a fairly advanced add-on that has both a module and an accessory. The module adds fields to the publish/edit page. When someone is viewing the publish/edit page and tries to open the accessory, the publish fields appear (regardless of which tab the user is currently on) and the accessory doesn’t open.
A quick look showed that the javascript that opens the accessory does so by hooking onto a html ID. The inherent issue is that when the custom fields added by the module are outputted, they are wrapped in a div tag using the same ID. This collision causes clicking the accessory to hook onto the wrong DOM node.
Furthermore, the ID for the accessory is set by the
$idproperty defined in
acc.add_on_name.phpInitially I had this property set to the add-on name
add_on_nameChanging this to anything else was causing a blank screen to be displayed.
Thinking I could just change the ID on the custom fields instead, I changed the key in the array passed to
$this->EE->layout->add_layout_tabschanging
$this->EE->layout->add_layout_tabs(array('add_on_name' => ...)))to
$this->EE->layout->add_layout_tabs(array('add_on_name_fields' => ...))))However, this didn’t solve the problem; the ID on the div wrapping the fields didn’t change.
I dug deeper into the EE core code and found that the ID on this wrapping field is coming from the name of the module
add_on_name from
mod.add_on_name.phpIs there something I missed? Is there a way to change either of these IDs so the accessory acts as expected on the publish page?
Hi Jeremy,
Thanks for posing here on the forums!
Have you looked over in the Development and Programming forum? That’s the place best suited for questions like this.
We just aren’t set up to offer direct support for add-on development. I do apologize.
Cheers,
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.