Craft\AmNavService::getNav PHP Method

getNav() public method

Get a navigation structure as HTML.
public getNav ( string $handle, array $params, array $locale = null ) : string
$handle string
$params array
$locale array
return string
    public function getNav($handle, $params, $locale = null)
    {
        $navigation = $this->getNavigationByHandle($handle);
        // Check for a missing nav and report the error appropriately
        if (!$navigation) {
            $e = new Exception(Craft::t('No navigation exists with the handle “{handle}”.', array('handle' => $handle)));
            if ($this->_isQuietErrorsEnabled()) {
                Craft::log('Error::', $e->getMessage(), LogLevel::Warning);
                return $navigation;
            } else {
                throw $e;
            }
        }
        $this->_navigation = $navigation;
        // We want correct URLs now
        $this->_parseEnvironment = true;
        // Get the params
        $this->_setParams($params);
        // We want HTML returned
        $this->_parseHtml = true;
        // Return build HTML
        return $this->getNodesByNavigationId($navigation->id, $locale);
    }