Skip to content

Extensibility Settings

WildcardSearch edited this page May 14, 2014 · 8 revisions

ASB Logo

This document is designed to explain the concepts of using settings with an Advanced Sidebox addon module. For further details, view the entire list of extensibility documents: Extensibility Docs

##Using Settings

Define a setting in the _info() function of your module and the value admin stores for that setting will be available in your module by accessing $args['settings']['setting_name'] (where setting_name is the name you supplied when defining the setting in the _info() function)

function asb_example_info()
{
	return array(
		"title" => 'Your Title Here',
		"description" => 'A description here',
		"version" =>	'1',
		"compatibility" => '2.1',
		"wrap_content" => true,
		"settings" => array(
			"setting_name" => array(
				"sid" => "NULL",
				"name" => "setting_name",
				"title" => 'Setting Name',
				"description" => 'setting description',
				"optionscode" => "text",
				"value" => 'default value'
			)
		)
	);
}

function asb_example_build_template($args)
{
	extract($args);
	global $$template_var;
	$$template_var = $settings['setting_name'];
	return true;
}

The above module would use the setting text entered by admin as the side box content. Not very useful but just for illustration.

For a slightly more polished version, look here: Simple Setting Example

Clone this wiki locally