Template Loader
On this page, you can learn about additional functions provided in the template loader.
Template Actions
In the loader, you can perform certain actions when installing, disabling, enabling, or uninstalling a template:
public function install()
{
// I will be called only on installation
}
public function disable()
{
// I will be called only when disabled
}
public function activate()
{
// When activated, I'll be here
}
public function uninstall()
{
// Oh no, I've been uninstalled, something must be done...
}
Module Overriding
The loader has the ability to override module templates. This allows editing module interfaces without directly modifying their interfaces:
public function register()
{
$this->addCustomPath(mm("Monitoring", "Resources/views/index"), 'modules/monitoring/index');
}
The first argument is the path to the module interface, and the second is the path within the template.
Components
The loader provides the ability to extend BladeOne by adding components.
Components are directives that can be used as shown below:
public function register()
{
$this->addComponentLayout('navigation', 'components/navigation');
}
And in the template itself (will call components/navigation
):
@navigation
Loading Translations
In the loader, you can add translations for the template using the loadTranslations()
function:
public function register()
{
$this->loadTranslations();
}
All translations must be inside the template in the i18n/
folder.