First id like to apologise if im asking any stupid questions, i have checked the docs but am not finding the answers to the questions i have. Ultimately all these boil down to one question… I figure there arent hooks to do what i want currently, should i code in hooks where i need them?
If you’re interested in details:
First, what im doing requires that i replicate that a field has been added and add a similar field to my table.
I can do that when the module has been installed, and could (i guess) have a sync button on my module admin screen, but itd be much nicer to do it at the point that a field were added.
Second, i need to deliver a fair amount of html to the tab of the publish / edit screen on my module, along with some jquery magic to be able to pull of what i need. Ultimately its just form fields, but with some cleverness. Is there an easy way to do this?
Third, id like to declare some new ‘global’ variables for templates. I figure i COULD write a plugin to do it, but {myplugin}{mytag}{/myplugin} is not as intuitive as {mytag}. If i could mash in some of my own variables into the globals when the globals are loaded, that would be mega useful. Just a thought, mind you.
I did tweet a few people yesterday, hopefully this will make my request a little clearer to anyone who was baffled then…
Any ideas would be great.
…should i code in hooks where i need them?
That’s dependent on if you want the product supported by EllisLab and an easy time upgrading EE in the future. The fact is that you technically can add in hooks and use them. We’ve done it a few times. You just have to maintain that in further releases. With a well documented project that’s not really so bad.
First, what im doing requires that i replicate that a field has been added and add a similar field to my table. I can do that when the module has been installed, and could (i guess) have a sync button on my module admin screen, but itd be much nicer to do it at the point that a field were added.
Before diving into that further, did the other post you mentioned answer this question?
Second, i need to deliver a fair amount of html to the tab of the publish / edit screen on my module, along with some jquery magic to be able to pull of what i need. Ultimately its just form fields, but with some cleverness. Is there an easy way to do this?
Sounds like you could just write an add-on for that. http://ellislab.com/expressionengine/user-guide/development/modules.html#tab_file
Third, id like to declare some new ‘global’ variables for templates. I figure i COULD write a plugin to do it, but {myplugin}{mytag}{/myplugin} is not as intuitive as {mytag}. If i could mash in some of my own variables into the globals when the globals are loaded, that would be mega useful. Just a thought, mind you.
It’s possible to add to the global variable array in an extension hook. I’ve done that in a few add-ons. A great example is Low’s Seg2Cat. You can see here how he’s created new variables and merged them into the existing global var array from within the sessions_end hook. https://github.com/lodewijk/low.seg2cat.ee2_addon/blob/master/low_seg2cat/ext.low_seg2cat.php#L364
For the record, the link i found wasnt quite what i was hoping it is. It looked to be a way to create a hook where there was none, but its not low level enough.
Iv ended up writing a custom hook, but thats just fine, because it works, and iv documented its location if ever we upgrade and need to re-enable it.
Will keep you posted, because it should be quite a useful module / extension when its all done.
The custom html in your modules control panel pages is as simple as creating a views directory inside your module directory. system/expressionengine/MyModule/views/index.php I would recommend grabbing taxonomy and looking through his layout. It’s fairly straight forward, and has some helpful code if you’re new to writing your own modules. I actually have to to the same thing when a column is added to a database. There is thread discussing my solution over here:
http://ellislab.com/forums/viewthread/191432/
Good luck
The custom html in your modules control panel pages is as simple as creating a views directory inside your module directory. system/expressionengine/MyModule/views/index.php I would recommend grabbing taxonomy and looking through his layout. It’s fairly straight forward, and has some helpful code if you’re new to writing your own modules. I actually have to to the same thing when a column is added to a database. There is thread discussing my solution over here: http://ellislab.com/forums/viewthread/191432/ Good luck
Thanks for that, what im after tho is custom layout on the publish tab.
Module views is fine, but ill definately need to output my own html to the publish tab…
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.