src/Charcoal/Admin/AdminTemplate.php
private function mainMenuIdent($options = null)
    {
        if ($this->mainMenuIdentLoaded === false) {
            $mainMenuIdent = null;

            if (isset($this['main_menu_item'])) {
                $mainMenuIdent = $this['main_menu_item'];
            }

            if (!(empty($options) && !is_numeric($options))) {
                if (is_string($options)) {
                    $mainMenuIdent = $options;
                } elseif (is_array($options)) {
                    if (isset($options['widget_options']['ident'])) {
                        $mainMenuIdent = $options['widget_options']['ident'];
                    }
                }
            }

            // Get main menu from the obj_type
            $objType = filter_input(INPUT_GET, 'obj_type', FILTER_SANITIZE_STRING);
            if ($objType) {
                $secondaryMenuItems = $this->adminConfig('secondary_menu');
                foreach ($secondaryMenuItems as $main => $item) {
                    if ($this->isObjTypeInSecondaryMenuItem($objType, $item)) {
                        $mainMenuIdent = $main;
                        break;
                    }
                }
            }

            // Choose main menu with a get parameter
            $mainMenuFromRequest = filter_input(INPUT_GET, 'main_menu', FILTER_SANITIZE_STRING);
            if ($mainMenuFromRequest) {
                $mainMenuIdent = $mainMenuFromRequest;
            }

            $this->mainMenuIdent = $mainMenuIdent;
            $this->mainMenuIdentLoaded = true;
        }

        return $this->mainMenuIdent;
    }
private function mainMenuIdent($options = null)
    {
        if ($this->mainMenuIdentLoaded === false) {
            $mainMenuIdent = null;

            if (isset($this['main_menu_item'])) {
                $mainMenuIdent = $this['main_menu_item'];
            }

            if (!(empty($options) && !is_numeric($options))) {
                if (is_string($options)) {
                    $mainMenuIdent = $options;
                } elseif (is_array($options)) {
                    if (isset($options['widget_options']['ident'])) {
                        $mainMenuIdent = $options['widget_options']['ident'];
                    }
                }
            }

            // Get main menu from the obj_type
            $objType = filter_input(INPUT_GET, 'obj_type', FILTER_SANITIZE_STRING);
            if ($objType) {
                $secondaryMenuItems = $this->adminConfig('secondary_menu');
                foreach ($secondaryMenuItems as $main => $item) {
                    if ($this->isObjTypeInSecondaryMenuItem($objType, $item)) {
                        $mainMenuIdent = $main;
                        break;
                    }
                }
            }

            // Choose main menu with a get parameter
            $mainMenuFromRequest = filter_input(INPUT_GET, 'main_menu', FILTER_SANITIZE_STRING);
            if ($mainMenuFromRequest) {
                $mainMenuIdent = $mainMenuFromRequest;
            }

            $this->mainMenuIdent = $mainMenuIdent;
            $this->mainMenuIdentLoaded = true;
        }

        return $this->mainMenuIdent;
    }
private function mainMenuIdent ( $ options = null ) { if ( $ this -> mainMenuIdentLoaded === false ) { $ mainMenuIdent = null ; if ( isset ( $ this [ 'main_menu_item' ] ) ) { $ mainMenuIdent = $ this [ 'main_menu_item' ] ; } if ( ! ( empty ( $ options ) && ! is_numeric ( $ options ) ) ) { if ( is_string ( $ options ) ) { $ mainMenuIdent = $ options ; } elseif ( is_array ( $ options ) ) { if ( isset ( $ options [ 'widget_options' ] [ 'ident' ] ) ) { $ mainMenuIdent = $ options [ 'widget_options' ] [ 'ident' ] ; } } } // Get main menu from the obj_type $ objType = filter_input ( INPUT_GET , 'obj_type' , FILTER_SANITIZE_STRING ) ; if ( $ objType ) { $ secondaryMenuItems = $ this -> adminConfig ( 'secondary_menu' ) ; foreach ( $ secondaryMenuItems as $ main => $ item ) { if ( $ this -> isObjTypeInSecondaryMenuItem ( $ objType , $ item ) ) { $ mainMenuIdent = $ main ; break ; } } } // Choose main menu with a get parameter $ mainMenuFromRequest = filter_input ( INPUT_GET , 'main_menu' , FILTER_SANITIZE_STRING ) ; if ( $ mainMenuFromRequest ) { $ mainMenuIdent = $ mainMenuFromRequest ; } $ this -> mainMenuIdent = $ mainMenuIdent ; $ this -> mainMenuIdentLoaded = true ; } return $ this -> mainMenuIdent ; }
Determine and retrieve the active main menu item's identifier.

@param  mixed $options The secondary menu widget ID or config.
@return string|null
Determine and retrieve the active main menu item s identifier .