Title: Nicely coded
Last modified: November 29, 2016

---

# Nicely coded

 *  [Michael Nelson](https://wordpress.org/support/users/mnelson4/)
 * (@mnelson4)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/nicely-coded/)
 * I’m one of the Event Espresso core developers who primarily worked on the forms
   system. I’ve scanned over the code and it looks very similar to our ideal for
   what an addon would look like. Thanks!
 * Is there a Github repo for this? That would be nice for collaboration IMO.
 * FYI we’ve recently added a better way for enqueuing scripts and CSS with form
   inputs.
 * You should basically put the contents of `EE_SSA_FILE::ssa_enqueue_scripts()`
   inside a new method `EE_File_Display_Strategy::enqueue_js()` (which overrides
   the parent’s `enqueue_js()` method). That way you’ll only enqueue js and css 
   when the input will actually be displayed. Right now, you’ll be enqueueing the
   JS and CSS as soon as the input is created, regardless of whether it’s actually
   displayed during this request or not. This change may make it work not work with
   older versions of EE4, before the `enqueue_js` method on fields was called consistently.
 * For that you might want to follow the model of our mock addon a little more closely,
   ie actually use `EE_Register_Addon::register()` to register your addon, register
   a module (eg name it something like `EED_SSA_File_Input` which sets up all the
   actions and filters your addon needs), and also set a minimum EE core version.
   This way, if someone tries to run your add-on with an older version of EE, they’ll
   get a notice saying it’s too old and then the actions/filters won’t be executed.
 * But for the most part, this seems to work great.

Viewing 1 replies (of 1 total)

 *  Plugin Author [wordgeniee](https://wordpress.org/support/users/wordgenie/)
 * (@wordgenie)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/nicely-coded/#post-8501953)
 * ​Hi Mike,
 * Thank you for suggestions and review. We will try to integrate the suggested 
   changes in next plugin update.

Viewing 1 replies (of 1 total)

The topic ‘Nicely coded’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/files-addon-for-event-espresso-4.
   svg)
 * [Files Addon for Event Espresso 4](https://wordpress.org/plugins/files-addon-for-event-espresso-4/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/files-addon-for-event-espresso-4/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/files-addon-for-event-espresso-4/)
 * [Active Topics](https://wordpress.org/support/plugin/files-addon-for-event-espresso-4/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/files-addon-for-event-espresso-4/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/files-addon-for-event-espresso-4/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [wordgeniee](https://wordpress.org/support/users/wordgenie/)
 * Last activity: [9 years, 4 months ago](https://wordpress.org/support/topic/nicely-coded/#post-8501953)