Recent Topics

Disable Plugin Settings based on Another Setting...

Started by on May 22, 2006 – Contents updated: Aug 10, 2016

May 22, 2006 15:24    


For my Gallery Plugin i have;
Re-Size Style ( Type: Select ; Values: 'None', 'Area', 'Size' )
Re-Size Width ( Type: Integer )
Re-Size Height ( Type: Integer )

Now when the Re-Size Style's Value is 'None' i would like to disable the Re-Size Width and Height Settings...

But this cannot be done as the $this->Settings is not yet defined when GetDefaultSettings() is called...

Any help?

May 22, 2006 15:33

You might want to look at Plugin::PluginSettingsValidateSet() and Plugin::PluginSettingsUpdateAction().

I'll look into allowing "onclick" as a param for settings also, which would allow to handle this dynamically, too.

May 22, 2006 16:24

Ok, the real solution has been to use


function getDefaultSettings()
  $r array(
    // default settings
  if( isset($this->Settings) )
  { // Settings get queried again to get displayed in "edit settings"
    // manipulate $r, according to $this->Settings->get(...)
  return $;

May 22, 2006 16:27

Yep done via;


if( isset ( $this->Settings ) && $this->Settings->get('Resize_Style') == 'none' ) {
      $Settings['ResizeAt_Width']['disabled']  = true;
      $Settings['ResizeAt_Height']['disabled'] = true;
    return $Settings;

Although the realtime hook during runtime would be pretty sweet....

May 22, 2006 22:46

"id", "onclick" and other useful JS handlers now get passed through to the edit settings form.

See the Test plugin (just updated), where I've added an example for it.

Form is loading...

CMS + forums – This forum is powered by b2evolution CMS, a complete engine for your website.