Skip to content

Extensibility Peekers

Mark Vincent edited this page Jun 18, 2019 · 2 revisions

ASB Logo

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

Peekers

Peekers are a convention used in the MyBB ACP to control the visibility of one or more settings based on the value of a controller element. For example, if you had a setting that did absolutely nothing if another boolean setting was false then there would be no point in showing it to the user. In fact, it might confuse them and cause invalid bug reports.

Using Peekers

In order to allow developers to output peeker JavaScript, the API has been extended with the settings_load function

function asb_peeker_example_settings_load()
{
	echo <<<EOF

	<script type="text/javascript">
	new Peeker($('.setting_first_setting'), $('#setting_second_setting'), /1/, true);
	</script>
EOF;
}

For a working example, look here: Simple Peeker Example

Next Topic

Serializing Settings