src/Menu/MenuModulesInterpreter.php
public function interpret()
    {
        /** @var Collection|ModuleInterface[] $modules */
        $modules = $this->sortModules(
            $this->core->modules()->getModules()
        );

        foreach ($modules as $moduleKey => $module) {

            // If the configuration has overriding data for this module's presence,
            // use it. Otherwise load the menu's own presence.
            // Normalize single & plural presences for each module.

            if ($this->isConfiguredModulePresenceDisabled($module)) {
                continue;
            }

            if ($this->hasConfiguredModulePresence($module)) {

                $configuredPresencesForModule = $this->normalizeConfiguredPresence(
                    $this->getConfiguredModulePresence($module)
                );

                $presencesForModule = $this->mergeNormalizedMenuPresences(
                    $this->normalizeMenuPresence($module->getMenuPresence()),
                    $configuredPresencesForModule
                );

            } else {
                // If no configuration is set, simply normalize and use the original

                $presencesForModule = $this->normalizeMenuPresence($module->getMenuPresence());
            }


            // If a module has no presence, skip it
            if ( ! $presencesForModule) {
                continue;
            }

            $standard    = [];
            $alternative = [];

            foreach ($presencesForModule as $presence) {

                // If a menu presence is deemed 'alternative',
                // it should not appear in the normal menu structure.
                if ($this->isMenuPresenceAlternative($presence)) {

                    $alternative[] = $presence;
                    continue;
                }

                $standard[] = $presence;
            }

            if (count($standard)) {
                $this->presences->standard->put($moduleKey, $standard);
            }
            if (count($alternative)) {
                $this->presences->alternative->put($moduleKey, $alternative);
            }
        }

        return $this->presences;
    }
public function interpret()
    {
        /** @var Collection|ModuleInterface[] $modules */
        $modules = $this->sortModules(
            $this->core->modules()->getModules()
        );

        foreach ($modules as $moduleKey => $module) {

            // If the configuration has overriding data for this module's presence,
            // use it. Otherwise load the menu's own presence.
            // Normalize single & plural presences for each module.

            if ($this->isConfiguredModulePresenceDisabled($module)) {
                continue;
            }

            if ($this->hasConfiguredModulePresence($module)) {

                $configuredPresencesForModule = $this->normalizeConfiguredPresence(
                    $this->getConfiguredModulePresence($module)
                );

                $presencesForModule = $this->mergeNormalizedMenuPresences(
                    $this->normalizeMenuPresence($module->getMenuPresence()),
                    $configuredPresencesForModule
                );

            } else {
                // If no configuration is set, simply normalize and use the original

                $presencesForModule = $this->normalizeMenuPresence($module->getMenuPresence());
            }


            // If a module has no presence, skip it
            if ( ! $presencesForModule) {
                continue;
            }

            $standard    = [];
            $alternative = [];

            foreach ($presencesForModule as $presence) {

                // If a menu presence is deemed 'alternative',
                // it should not appear in the normal menu structure.
                if ($this->isMenuPresenceAlternative($presence)) {

                    $alternative[] = $presence;
                    continue;
                }

                $standard[] = $presence;
            }

            if (count($standard)) {
                $this->presences->standard->put($moduleKey, $standard);
            }
            if (count($alternative)) {
                $this->presences->alternative->put($moduleKey, $alternative);
            }
        }

        return $this->presences;
    }
public function interpret ( ) { /** @var Collection|ModuleInterface[] $modules */ $ modules = $ this -> sortModules ( $ this -> core -> modules ( ) -> getModules ( ) ) ; foreach ( $ modules as $ moduleKey => $ module ) { // If the configuration has overriding data for this module's presence, // use it. Otherwise load the menu's own presence. // Normalize single & plural presences for each module. if ( $ this -> isConfiguredModulePresenceDisabled ( $ module ) ) { continue ; } if ( $ this -> hasConfiguredModulePresence ( $ module ) ) { $ configuredPresencesForModule = $ this -> normalizeConfiguredPresence ( $ this -> getConfiguredModulePresence ( $ module ) ) ; $ presencesForModule = $ this -> mergeNormalizedMenuPresences ( $ this -> normalizeMenuPresence ( $ module -> getMenuPresence ( ) ) , $ configuredPresencesForModule ) ; } else { // If no configuration is set, simply normalize and use the original $ presencesForModule = $ this -> normalizeMenuPresence ( $ module -> getMenuPresence ( ) ) ; } // If a module has no presence, skip it if ( ! $ presencesForModule ) { continue ; } $ standard = [ ] ; $ alternative = [ ] ; foreach ( $ presencesForModule as $ presence ) { // If a menu presence is deemed 'alternative', // it should not appear in the normal menu structure. if ( $ this -> isMenuPresenceAlternative ( $ presence ) ) { $ alternative [ ] = $ presence ; continue ; } $ standard [ ] = $ presence ; } if ( count ( $ standard ) ) { $ this -> presences -> standard -> put ( $ moduleKey , $ standard ) ; } if ( count ( $ alternative ) ) { $ this -> presences -> alternative -> put ( $ moduleKey , $ alternative ) ; } } return $ this -> presences ; }
Interprets configured module presences and returns a normalized data object.

@return MenuConfiguredModulesDataInterface
Interprets configured module presences and returns a normalized data object .