BoltWire

Innovative Ideas :: Radical Results!

INFORMATION

DOCUMENTATION

SOLUTIONS

Toolmaps

Documentation > Extending BoltWire > Toolmaps

BoltWire has an innovative system for customizing specific tools, called toolmapping. Basically, you can map system commands, functions, and conditions to custom functions, or map custom labels to system functions. Here's how it works.

Mapping to Custom Functions

Suppose you wanted to write some kind of custom login system. Toolmapping makes this easy. In a config.php file, just define your map like this:

<code>
$BOLTtoolmap['x']['login'] = 'mylogin';
</code>

Use 'f' for functions, 'x' for commands, and 'c' for conditions. Then create your own custom login function, either by 1) copying the BOLTXlogin function from commands.php, to your config file, renaming it to BOLTXmylogin, and modifying it as needed, or 2) write one completely from scratch. Just be sure to take note of the appropriate input and return values.

Note: In this specific example, you would want to be careful to reproduce the session login keys in your custom function, including group memberships, so it would work with the rest of the system.

Mapping from Custom Labels

Suppose you wanted to use a different label for a core function. Like 'research' instead of 'search'. That's easy. Just go:

<code>
$BOLTtoolmap['f']['research'] = 'search';
</code>

Then any time BoltWire encounters a functions like [(research...)] it will treat it as if you were calling the default search function. In this case, the word 'search' would also continue to work. To disable the search label, simply map it to a function that does not exist or to NULL.

Note: This technique can also be used to disable any functions you do not want available in your installation.

This has several interesting possibilities. A French speaker, for example, could map the word 'recherche' to 'search', thus providing language specific commands.

Using toolmapping gives you tremendous control over all the core functions, commands, and conditions.

Copyright © 2013, all rights reserved.