Craft\AmNavService::getNavigations PHP Method

getNavigations() public method

Get all build navigations.
public getNavigations ( string $indexBy = null, boolean $indexAllData = false ) : array
$indexBy string [Optional] Return the navigations indexed by an attribute.
$indexAllData boolean [Optional] Whether to return all the data or just the navigation name.
return array
    public function getNavigations($indexBy = null, $indexAllData = false)
    {
        $navigationRecords = AmNav_NavigationRecord::model()->ordered()->findAll();
        $navigations = AmNav_NavigationModel::populateModels($navigationRecords);
        if ($indexBy !== null) {
            $indexedNavigations = array();
            foreach ($navigations as $navigation) {
                $indexedNavigations[$navigation->{$indexBy}] = $indexAllData ? $navigation : $navigation->name;
            }
            return $indexedNavigations;
        }
        return $navigations;
    }