Skip to content

Commit

Permalink
Add: page content from plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
idoalit committed Mar 19, 2021
1 parent 14f6c52 commit 27745a5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
10 changes: 10 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@
$metadata = '<meta name="robots" content="noindex, follow">';
}
include LIB.'contents/'.$path.'.inc.php';
}
// check path from plugins
elseif (isset(($menu = \SLiMS\Plugins::getInstance()->getMenus('opac'))[$path])) {
if (file_exists($menu[$path][3])) {
$page_title = $menu[$path][0];
include $menu[$path][3];
} else {
// not found
http_response_code(404);
}
} else {
// get content data from database
$metadata = '<meta name="robots" content="index, follow">';
Expand Down
7 changes: 6 additions & 1 deletion lib/Plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,12 @@ public function register($hook, $callback)
public function registerMenu($module_name, $label, $path, $description = null)
{
$hash = md5(realpath($path));
$this->menus[$module_name][$hash] = [$label, AWB . 'plugin_container.php?mod=' . $module_name . '&id=' . $hash, $description, realpath($path)];
if ($module_name === 'opac') {
$name = strtolower(implode('_', explode(' ', $label)));
$this->menus[$module_name][$name] = [$label, SWB . 'index.php?p=' . $module_name, $description, realpath($path)];
} else {
$this->menus[$module_name][$hash] = [$label, AWB . 'plugin_container.php?mod=' . $module_name . '&id=' . $hash, $description, realpath($path)];
}
}

public function execute($hook, $params = [])
Expand Down

0 comments on commit 27745a5

Please sign in to comment.