method routeComponent documentation in bbn\Mvc\Router
function(string $name)
{
if ($p = $this->getPluginFromComponent($name)) {
$root = $p['path'] . 'src/';
$prefix = $p['name'] . '-';
$plugin = $p['name'];
$plugin_url = $p['url'];
}
else {
$root = $this->appPath();
$prefix = (defined('BBN_APP_PREFIX') ? BBN_APP_PREFIX : BBN_APP_NAME) . '-';
if (X::indexOf($name, $prefix) !== 0) {
$prefix = substr($name, 0, strpos($name, '-') + 1);
}
$plugin = null;
$plugin_url = null;
}
if (!empty($root) && (X::indexOf($name, $prefix) === 0)) {
$local_name = substr($name, strlen($prefix));
$parts = explode('-', $local_name);
$root .= 'components/';
$path = implode('/', $parts);
$dir = $root . $path;
$this->_registerLocaleDomain($plugin);
if (is_dir($dir)) {
$res = [
'js' => [],
'html' => [],
'css' => [],
];
$fpath = $root . $path . '/' . end($parts);
foreach ($res as $mode => $c) {
foreach (self::$_filetypes[$mode] as $f) {
if (is_file($fpath . '.' . $f)) {
$res[$mode] = $this->_set_known(
[
'file' => $fpath . '.' . $f,
'path' => str_replace('-', '/', $local_name),
'plugin' => $plugin_url,
'plugin_name' => $plugin,
'component' => true,
'component_name' => $name,
'ext' => $f,
'mode' => $mode,
'i18n' => $mode === 'js' ? $this->_find_translation($plugin ?? null) : null,
], true
);
break;
}
}
}
return $res;
}
}
return null;
}
BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2025
BBN Solutions