We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

ID Collision Between Module and Accessory

Development and Programming

Warble Media's avatar
Warble Media
14 posts
13 years ago
Warble Media's avatar Warble Media

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

$id

property defined in

acc.add_on_name.php

Initially I had this property set to the add-on name

add_on_name

Changing 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_tabs

changing

$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.php

Is there something I missed? Is there a way to change either of these IDs so the accessory acts as expected on the publish page?

       
Warble Media's avatar
Warble Media
14 posts
13 years ago
Warble Media's avatar Warble Media

Anyone have any ideas on this?

       
Dan Decker's avatar
Dan Decker
7,338 posts
13 years ago
Dan Decker's avatar Dan Decker

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,

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.