¡Hola, amigos! I’m Señor FAQ, the mustached maestro of questions and answers! With my trusty glasses and a book of endless wisdom, I turn dudas into solutions. Soy el héroe de los curiosos and the champion of clarity.
config_end_render
The config_end_render
hook is executed at the end of the configuration file.
This file is the first to load for every page in JScms, making this hook ideal for initializing settings, adding configurations, or extending functionality before the application logic begins.
DynamicHooks::executeHook('config_end_render', false, $jkv, $lang);
This hook is triggered using the DynamicHooks::executeHook()
method with the following parameters:
'config_end_render'
- The unique identifier for this hook.false
- The default return value if no callbacks are registered.$jkv
- The configuration array containing JScms settings.$lang
- The active language for JScms.
The config_end_render
hook is useful for tasks that need to occur immediately after the configuration file is fully loaded.
Examples include modifying or extending configuration values, setting global variables, or adding initialization logic for plugins or modules.
DynamicHooks::addHook('config_end_render', function ($jkv, $lang) {
// Add a custom setting to the configuration
$jkv['custom_setting'] = 'custom_value';
// Log the active language for debugging purposes
error_log("Config file loaded with active language: " . $lang);
// Initialize a custom service or library
if (!isset($jkv['custom_library_initialized'])) {
CustomLibrary::initialize($jkv, $lang);
$jkv['custom_library_initialized'] = true;
}
}, 'custom_plugin');