Skip to content

Commit

Permalink
Avoid displaying notices when a subpanel definition key cannot be found
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Ernst authored and mattlorimer committed Oct 26, 2020
1 parent 8a00696 commit 168b59c
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions include/SubPanel/SubPanelDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -705,11 +705,32 @@ public function get_available_tabs($FromGetModuleSubpanels = false)
*/
public function load_subpanel($name, $reload = false, $original_only = false, $search_query = '', $collections = array())
{
if (!is_dir('modules/' . $this->layout_defs [ 'subpanel_setup' ][ strtolower($name) ] [ 'module' ])) {
$panelName = strtolower($name);

if (!array_key_exists($panelName, $this->layout_defs ['subpanel_setup'])) {
LoggerManager::getLogger()->error(
sprintf(
"Trying to load subpanel without definition: %s in module %s",
$panelName,
$this->_focus->module_dir
)
);
return false;
}

if (!is_dir('modules/' . $this->layout_defs ['subpanel_setup'][$panelName] ['module'])) {
return false;
}

$subpanel = new aSubPanel($name, $this->layout_defs [ 'subpanel_setup' ] [ strtolower($name) ], $this->_focus, $reload, $original_only, $search_query, $collections) ;
$subpanel = new aSubPanel(
$name,
$this->layout_defs ['subpanel_setup'] [$panelName],
$this->_focus,
$reload,
$original_only,
$search_query,
$collections
);

// only return the subpanel object if we can display it.
if ($subpanel->canDisplay == true) {
Expand Down

0 comments on commit 168b59c

Please sign in to comment.