// Import framework stuff
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
use Org\Mxchange\CoreFramework\Filesystem\FileNotFoundException;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+use Org\Mxchange\CoreFramework\Traits\Template\CompileableTemplateTrait;
/**
* A general menu system class
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseMenu extends BaseFrameworkSystem {
+ // Load traits
+ use CompileableTemplateTrait;
+
/**
* Protected constructor
*
* @param $className Name of the class
* @return void
*/
- protected function __construct ($className) {
+ protected function __construct (string $className) {
// Call parent constructor
parent::__construct($className);
}
*/
public function renderMenu () {
// Initialize the menu system by preparing it's template instance
- $templateInstance = ObjectFactory::createObjectByConfiguredName('menu_template_class', array($this));
+ $templateInstance = ObjectFactory::createObjectByConfiguredName('menu_template_class', [$this]);
// Set it for later use
$this->setTemplateInstance($templateInstance);
// If page is empty, choose default
if (empty($command)) {
// Use default page as none has been specified
- $command = $this->getConfigInstance()->getConfigEntry('default_' . GenericRegistry::getRegistry()->getInstance('app')->getAppShortName() . '_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_command');
- } // END - if
+ $command = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('default_' . ApplicationHelper::getSelfInstance()->getAppShortName() . '_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_command');
+ }
// Load the menu template for this page
try {
$templateInstance->loadMenuTemplate($command . '_menu_entries');
} catch (FileNotFoundException $e) {
// Log exception @TODO Maybe to intrusive?
- self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: Exception caught: ' . $e->__toString() . ', with message: ' . $e->getMessage());
+ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-MENU: Exception caught: ' . $e->__toString() . ', with message: ' . $e->getMessage());
}
// Render template data here