PHP Class Craft\AmNavService

Inheritance: extends craft\BaseApplicationComponent
Datei anzeigen Open project: am-impact/amnav

Public Methods

Method Description
deleteNavigationById ( integer $navId ) : boolean Delete a navigation by its ID.
getActiveNodeIdForLevel ( string $handle, integer $segmentLevel = 1 ) : integer | boolean Get an active node ID for a specific navigation's level.
getBreadcrumbs ( array $params ) : string Get a navigation structure as HTML.
getNav ( string $handle, array $params, array $locale = null ) : string Get a navigation structure as HTML.
getNavRaw ( string $handle, array $params, string $locale = null ) : array Get a navigation structure without any HTML.
getNavigationByHandle ( string $handle ) : craft\AmNav_NavigationModel | null Get a navigation by its handle.
getNavigationById ( integer $navId ) : craft\AmNav_NavigationModel | null Get a navigation by its ID.
getNavigationNameByHandle ( string $handle ) : string | null Get a navigation name by its handle.
getNavigations ( string $indexBy = null, boolean $indexAllData = false ) : array Get all build navigations.
getNavigationsByCommand ( array $variables ) : array Get navigations by a given command.
getNodesByNavigationId ( integer $navId, string $locale = null ) : array Get all nodes by its navigation ID.
getParentOptions ( array $nodes, mixed $maxLevel = false, boolean $skipFirst = false ) : array Get parent options for given nodes.
saveNavigation ( craft\AmNav_NavigationModel $navigation ) : boolean Saves a navigation.

Private Methods

Method Description
_buildBreadcrumbsHtml ( ) : string Create the breadcrumbs HTML.
_buildNav ( array $nodes, integer $parentId, integer $level = 1 ) : array Create the navigation based on parent IDs and order.
_buildNavHtml ( array $nodes, integer $parentId, integer $level = 1 ) : string Create the navigation HTML based on parent IDs and order.
_getActiveElements ( ) : array Get active elements based on URI.
_getParam ( string $name, mixed $default ) : mixed Get parameter value.
_isChildActive ( array $nodes, integer $parentId ) : boolean Check whether a node has an active child.
_isNodeActive ( array $node ) : boolean Check whether the current node is active.
_isQuietErrorsEnabled ( ) : boolean Check whether to log errors or throw them.
_parseUrl ( array $node ) : string Parse URL.
_setActiveNodes ( array $nodes ) Check if nodes should be active based on the current URL.
_setParams ( array $params ) Set parameters for the navigation HTML output.

Method Details

deleteNavigationById() public method

Delete a navigation by its ID.
public deleteNavigationById ( integer $navId ) : boolean
$navId integer
return boolean

getActiveNodeIdForLevel() public method

Get an active node ID for a specific navigation's level.
public getActiveNodeIdForLevel ( string $handle, integer $segmentLevel = 1 ) : integer | boolean
$handle string Navigation handle.
$segmentLevel integer Segment level.
return integer | boolean

getBreadcrumbs() public method

Get a navigation structure as HTML.
public getBreadcrumbs ( array $params ) : string
$params array
return string

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

getNavRaw() public method

Get a navigation structure without any HTML.
public getNavRaw ( string $handle, array $params, string $locale = null ) : array
$handle string
$params array
$locale string
return array

getNavigationByHandle() public method

Get a navigation by its handle.
public getNavigationByHandle ( string $handle ) : craft\AmNav_NavigationModel | null
$handle string
return craft\AmNav_NavigationModel | null

getNavigationById() public method

Get a navigation by its ID.
public getNavigationById ( integer $navId ) : craft\AmNav_NavigationModel | null
$navId integer
return craft\AmNav_NavigationModel | null

getNavigationNameByHandle() public method

Get a navigation name by its handle.
public getNavigationNameByHandle ( string $handle ) : string | null
$handle string
return string | null

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

getNavigationsByCommand() public method

Get navigations by a given command.
public getNavigationsByCommand ( array $variables ) : array
$variables array
return array

getNodesByNavigationId() public method

Get all nodes by its navigation ID.
public getNodesByNavigationId ( integer $navId, string $locale = null ) : array
$navId integer
$locale string
return array

getParentOptions() public method

Get parent options for given nodes.
public getParentOptions ( array $nodes, mixed $maxLevel = false, boolean $skipFirst = false ) : array
$nodes array
$maxLevel mixed
$skipFirst boolean
return array

saveNavigation() public method

Saves a navigation.
public saveNavigation ( craft\AmNav_NavigationModel $navigation ) : boolean
$navigation craft\AmNav_NavigationModel
return boolean