Loading...
 
Skip to main content

History: Code Howto: Add a preference to an admin panel

Source of version: 13 (current)

Copy to clipboard
See also: ((Create a new preference))

You simply need to use the [https://sourceforge.net/p/tikiwiki/code/HEAD/tree/trunk/lib/smarty_tiki/function.preference.php|''preference'' smarty plugin] in one of the administration panel templates (__[https://sourceforge.net/p/tikiwiki/code/HEAD/tree/trunk/templates/admin/|templates/admin/include_*.tpl]__).

{CODE(caption=Sample inclusion)}
{preference name=example_my_pref_name}
{CODE}

!! How to hide options with dependencies

Just add id="feature_xyz_childcontainer" where feature_xyz is the name of the parent features. So if parent feature is off...

For a radio field use id="fgal_use_db_childcontainer_1" for the first radio button, id="fgal_use_db_childcontainer_2" for the second radio button ...

{CODE(colors="htmlmixed")}<div class="adminoptionboxchild" id="feature_multilingual_childcontainer">
This text will just appear if feature_multilingual is activated
</div>{CODE}

To have a longer preference name in search results, yet a shorter one visible in the template:
{CODE()}{preference name=some_name label="{tr}Shorter Name{/tr}"}
{CODE}

!! Preference always visible
{CODE()}				{preference name=feature_wiki visible="always"}{CODE}

This can be useful to avoid the basic/advanced tags (filters) on certain admin panels

!! Templates
The templates to modify the look & feel of the preferences:
http://sourceforge.net/p/tikiwiki/code/HEAD/tree/trunk/templates/prefs/


-=alias=-
* (alias(Code Howto: Add a preference to a control panel))
Show PHP error messages