¡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.
register_dynamic_urls
The register_dynamic_urls
hook allows plugins to define their own dynamic URLs that can be used as shortcodes
for easy integration within the JScms system. This provides flexibility for plugins to register additional URLs dynamically.
$dynamicUrls = [
'tags' => 'slugfortags',
'search' => 'slugforsearch',
'news' => 'slugfornews',
'login' => 'slugforsitelogin',
'logout' => 'logout',
'profile' => 'slugforsiteprofile',
'register' => 'slugforsiteregister'
];
$dynamicUrlsHook = DynamicHooks::executeHook('register_dynamic_urls', false);
// Merge hook-provided dynamic URLs with core URLs
$hookUrls = array_reduce(
$dynamicUrlsHook,
fn(array $carry, $namespaceUrls) => is_array($namespaceUrls) ? array_merge($carry, $namespaceUrls) : $carry,
[]
);
$dynamicUrls = array_merge($dynamicUrls, $hookUrls);
// Register all dynamic URLs as shortcodes
registerDynamicUrls($dynamicUrls, $jkv);
This hook dynamically extends the core URL shortcodes by allowing plugins to register their own.
DynamicHooks::addHook('register_dynamic_urls', function () {
return [
'your_plugin' => 'slugforplugin',
'your_plugin_page' => 'slugforpluginpage'
];
}, 'your_plugin');