Hook Request

5 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: March 5, 2013   (RSS)

By Dave - March 5, 2013

Hi Glen, 

>Alternatively, can you suggest a way of intercepting the output to perform modifications?

Sometimes we just modify the $schema global after it's been loaded.  

Can you let me know some more details on what you're trying to do?  I'll try and suggest some options.

Thanks!

Dave Edis - Senior Developer

interactivetools.com

By ITI - March 5, 2013

Hi Dave

Since writing the post, I believe I have found a better and more appropriate solution to my issue.

Basically I want to change the menuNames and set warnings in the interface if the plugin isn't activated. I can't have the end user modifying table data if the plugin isn't active since a lot of the input data is in hidden calculated fields.

I'm just in the process of testing the use of hooks "plugin_activate and plugin_deactivate".  These appear to be far more appropriate for what I am trying to achieve including the hiding the tables altogether (when not active).

Anyway, with all the code review and investigation I had done, there is no way (that I could find) to do any customization to the "Edit Field" dialog since the call to loadSchema() is just prior to showing the dialog content. I was mainly looking at the schema data not any of the global vars.

So, although it does look like I will need the hook I was asking about I still think it might be a useful hook for some thing else in the future.

My post should be revised to "A good place to add a hook" !

Thanks for getting back to me so quick.

Glen







http://www.CanadianDomainRegistry.ca







ITI Internetworking Technologies Inc.

By Dave - March 5, 2013

Hi Glen,

Ok, great.  Here's a few other things to check out if you haven't already seen them: 

Under Admin > Section Editors > Your Section > Advanced (Tab) there's a field called "Required Plugins".  If you put the filename only (eg: myplugin.php)  in that field the user won't be able to access the section unless that plugin is active.

You can also add this to a plugin header (in the comments at the top)  to force it load everytime and prevent it from being deactivated:

Required System Plugin: true

For hiding tables, you can set  'menuHidden' => '1', in the schema to hide the menu, and 'tableHidden' => '1', to hide the table from the section editor list.  We hide certain internal tables such as uploads, _accesslist, etc.

And in regards to the field editor, it's due for a rewrite but we haven't got to it yet.  So when it gets updated perhaps there will be more hooks.  Eventually we'd like to have able to have plugins add new field types.

Good luck with your plugin and let us know any other questions, thanks!

Dave Edis - Senior Developer

interactivetools.com

By ITI - March 5, 2013 - edited: March 6, 2013

Thanks Dave.

I was already using the "'menuHidden'" key in the plugin_activate/deactivate hooks which addressed the user input issues.

I was not aware of that schema key ''tableHidden'' which addresses my concerns in the section editor, thanks for  bringing that to my attention.  I've tested it and that works perfectly.

I don't think this will need to be a system plugin with the use of the keys mentioned above.

After entering the plugin file name in 'Required Plugins'  it didn't do any thing.  But I suspect it would if I required a plugin other than 'itself".  The two keys above do the trick so I won't pursue this.

I now understand how the "Required Plugin" works. It adds a little insurance but as with the keys, if the user manually edits the schema file we've lost control anyway.

Thanks for the tips.

Glen







http://www.CanadianDomainRegistry.ca







ITI Internetworking Technologies Inc.