Recent Topics

1 Jun 11, 2011 04:27    

Hi, Can you please give me some direction please? I am developing this plugin and all works well, except I am not successful to display a setting in SkinBeginHtmlHead( & $params ) specified in my get_widget_param_definitions( $params )

here is a sample:

function get_widget_param_definitions( $params )
	{
		return array(

		'theme' => array(
				'label' => $this->T_('theme'),
				'note' => $this->T_('Modify this option with the desired theme name'),
				'type' => 'select',
				'options' => array( 'default' => 'default', 'metallic' => 'metallic' ),
				'defaultvalue' => 'true'
			),
		);
	}





	function SkinBeginHtmlHead( & $params )
							{  	global $Plugins, $plugins_url;							
								
								$comm_start = '<!-- Start plugin -->';
								$comm_end = '<!-- End plugin -->';
								
								$jvscode = '
					                        
jQuery.noConflict();
			(function($) {
	$(function () {
		$("#theme").theme({
		
[b]theme : "'.$params['theme'].'",[/b]


		});

	      });
			})(jQuery);';
								
							
								$plug_url = $this->get_plugin_url();
								
																
								require_js( $plug_url . 'js/demo.js', true );
								add_headline( $comm_start );
								add_js_headline( $jvscode );
								add_headline( $comm_end );
														
								
								return true;
							}
} 

When this code is rendered in the browser everything works except theme shows up empty-> theme : ""

Any ideas for me please? Thanks.

2 Jun 13, 2011 20:49

'defaultvalue' => 'true'


This value should be the one defined in options.

I believe you can only use "get_widget_param_definitions" in widget context e.g. when called from SkinTag hook. You specify widget params there.

All global params should go in "GetDefaultSettings"

/**
 * Define settings that the plugin uses/provides.
 */
function GetDefaultSettings()
{
	return array();
}

In your case you can simply rename "get_widget_param_definitions" to "GetDefaultSettings" and then replace $params['theme'] with

$this->Settings->get('theme')


Form is loading...