Tutorials > 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:
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.
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:
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.
This technique can also be used to disable any functions you do not want available in your installation. Just point a function to something that does not exist. BoltWire will ignore the call to that function and return a null value.
BoltWire runs commands, functions and conditions through the translation engine automatically, when a language is set. This means you can use the equivalent word for any of them if it is include in the language pack, and it will work as if you used the English equivalent.
To create new commands, functions, or conditions simply create a new function called BOLTXnewcommand, BOLTFnewfunction, BOLTCnewcondition. Model it on existing code or create something entirely new from scratch--and store it in config.php or a plugin. Just make sure you have the correct inputs and return the correct value. Call it using the name assigned to the function.
See the Webhooks tutorial for information about how to overwrite some of BoltWire's core system processes.
See the tutorial on the markup table for information about how to rewrite BoltWire's default markup table.