Recent Topics

1 May 22, 2006 15:24    

Hey,

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?

2 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.

3 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 $;
}

4 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....

5 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...