]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/menu/class_BaseMenu.php
Continued:
[core.git] / framework / main / classes / menu / class_BaseMenu.php
index 642a01ba79946e6023a5d49d3099cf3febd9606b..dbf535563a3a1e713d2b95720018d4c754771cea 100644 (file)
@@ -4,11 +4,12 @@ namespace Org\Mxchange\CoreFramework\Menu;
 
 // 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
@@ -33,13 +34,16 @@ use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
  * 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);
        }
@@ -52,7 +56,7 @@ abstract class BaseMenu extends BaseFrameworkSystem {
         */
        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);
@@ -66,15 +70,15 @@ abstract class BaseMenu extends BaseFrameworkSystem {
                // 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