/** * Dynamic AdminCP menu generator for extensions * * @return array */ public function acpMenu() { $extensions = \IPS\faker\Faker::allExtensions(); $menu = array(); foreach ($extensions as $key => $extension) { $splitKey = explode('_', $key); /* What app is this extension for? */ $app = property_exists($extension, 'app') ? $extension::$app : implode('_', array_slice($splitKey, 0, -1)); /* Make sure the application is enabled */ if (!\IPS\Application::appIsEnabled($app)) { continue; } /* Do we need to create a new category for this app? */ if (!isset($menu[$app])) { $menu[$app] = array(); } $extName = implode('_', array_slice($splitKey, 1)); $menu[$app][$extName] = array('tab' => 'faker', 'controller' => $extension::$_controller, 'do' => "manage&module=generator&extApp={$app}&extension={$extName}", 'restriction' => $extension::$acpRestriction); } /* Append any misc. modules we want to display here */ $origMenu = parent::acpMenu(); $menu['tools'] = $origMenu['tools']; return $menu; }