Navigation
in package
Uses
CustomClass, Links, Menu, Pagination
Class for construct a navigation menu in LotGD.
This version avoid adding repeated links.
Table of Contents
- DEFAULT_NAVIGATION_TEXT_DOMAIN = 'navigation_app'
- Default text domain for navigation menu.
- $classHeader : string
- Class name for header.
- $classNav : string
- Class name for nav.
- $headers : array<string|int, mixed>
- Headers for navigation menu with options.
- $lastHeader : string
- Last header created.
- $links : array<string|int, mixed>
- List of links.
- $navigation : array<string|int, mixed>
- Navigation menu.
- $navs : array<string|int, mixed>
- Navs for navigation menu with options.
- $partialLinks : array<string|int, mixed>
- List of partial links.
- $textDomain : string
- Text domain for translator.
- $textDomainPrev : string
- Previous text domain.
- $dispatcher : mixed
- $request : mixed
- $settings : mixed
- __construct() : mixed
- addHeader() : $this
- Added nav header in navigation menu.
- addHeaderNotl() : mixed
- Add header but not translate.
- addLink() : $this
- Add a link to navigation menu.
- addNav() : mixed
- Add nav to navigation menu.
- addNavAllow() : $this
- Add a allowed nav for user.
- addNavExternal() : mixed
- Add an external link to navigation menu.
- addNavNotl() : mixed
- Add a nav to navigation menu but not translate.
- blockHideLink() : $this
- Block and hide a link.
- blockLink() : $this
- Block a link.
- blockPartialLink() : $this
- Block a partial link.
- checkNavs() : bool
- Determines if there are any navs for the player.
- forestNav() : void
- Create a navigations navs for forest.
- gardensNav() : void
- Create a navigations navs for gardens.
- getClassHeader() : string
- Get class name for header.
- getClassNav() : string
- Get class name for nav.
- getDefaultTextDomain() : string
- Get default text domain.
- getHeaders() : mixed
- Get information of headers.
- getLastHeader() : string
- Get the last header created.
- getNavigation() : mixed
- Get structure of navigation.
- getNavs() : mixed
- Get information of navs.
- getTextDomain() : string
- Get text domain for translator.
- graveyardNav() : void
- Create a navigations navs for graveyard.
- headerHasNavs() : bool
- Check if header has navs to show.
- isBlocked() : bool
- Check if link is blocked.
- isHided() : bool
- Check if link is hide.
- pagination() : mixed
- Navigation menu used with Paginator.
- setClassHeader() : self
- Set class name for header.
- setClassNav() : self
- Set class name for nav.
- setTextDomain() : $this
- Set text domain for translator.
- superuser() : void
- Add navs for actions of superuser.
- superuserGrottoNav() : void
- Add navs for action of superuser in Grotto page.
- townNav() : void
- unBlockLink() : $this
- Unblock a link.
- unBlockPartialLink() : $this
- Unblock a partial link.
- villageNav() : void
- Add nav to village/shades.
- addItem() : $this
- Private function to add a nav in navigation menu.
- block() : self
- Block a link.
- getExtraParamLink() : string
- Get a extra param for link.
- getKeyForNav() : int
- Get key for nav.
Constants
DEFAULT_NAVIGATION_TEXT_DOMAIN
Default text domain for navigation menu.
public
mixed
DEFAULT_NAVIGATION_TEXT_DOMAIN
= 'navigation_app'
Properties
$classHeader
Class name for header.
protected
string
$classHeader
= 'navhead'
$classNav
Class name for nav.
protected
string
$classNav
= 'nav'
$headers
Headers for navigation menu with options.
protected
array<string|int, mixed>
$headers
= []
$lastHeader
Last header created.
protected
string
$lastHeader
= ''
$links
List of links.
protected
array<string|int, mixed>
$links
= []
$navigation
Navigation menu.
protected
array<string|int, mixed>
$navigation
= []
$navs
Navs for navigation menu with options.
protected
array<string|int, mixed>
$navs
= []
$partialLinks
List of partial links.
protected
array<string|int, mixed>
$partialLinks
= []
$textDomain
Text domain for translator.
protected
string
$textDomain
= self::DEFAULT_NAVIGATION_TEXT_DOMAIN
$textDomainPrev
Previous text domain.
protected
string
$textDomainPrev
= ''
$dispatcher
private
mixed
$dispatcher
$request
private
mixed
$request
$settings
private
mixed
$settings
Methods
__construct()
public
__construct(EventDispatcherInterface $dispatcher, Request $request, Settings $settings) : mixed
Parameters
Return values
mixed —addHeader()
Added nav header in navigation menu.
public
addHeader(string $header[, array<string|int, mixed> $options = [] ]) : $this
Parameters
- $header : string
-
Name for a header
- $options : array<string|int, mixed> = []
-
Is a options for header. Options can have a multiple values like: [ //-- Core use this
translate
andparams
if exist 'translate' => true, //-- Determine if want translate header or not 'textDomain' => 'navigation_app', //-- Determine domain for a nav. 'params' => [ //-- This is used en translation, if you need 'key' => 'value', 'key1' => 'value1', 'key2' => 'value2', ], //-- Can add other data if you need ]
Return values
$this —addHeaderNotl()
Add header but not translate.
public
addHeaderNotl(string $header[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $header : string
- $options : array<string|int, mixed> = []
Return values
mixed —addLink()
Add a link to navigation menu.
public
addLink(string $link) : $this
Parameters
- $link : string
Return values
$this —addNav()
Add nav to navigation menu.
public
addNav(string|null $label[, string|null $link = null ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $label : string|null
- $link : string|null = null
- $options : array<string|int, mixed> = []
Return values
mixed —addNavAllow()
Add a allowed nav for user.
public
addNavAllow(string $link) : $this
Parameters
- $link : string
Return values
$this —addNavExternal()
Add an external link to navigation menu.
public
addNavExternal(string|null $label[, string|null $link = null ][, array<string|int, mixed> $options = [] ]) : mixed
Use this for add a extra security (rel="noopener noreferrer") and open in new tab.
Parameters
- $label : string|null
- $link : string|null = null
- $options : array<string|int, mixed> = []
Return values
mixed —addNavNotl()
Add a nav to navigation menu but not translate.
public
addNavNotl(string|null $label[, string|null $link = null ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $label : string|null
- $link : string|null = null
- $options : array<string|int, mixed> = []
Return values
mixed —blockHideLink()
Block and hide a link.
public
blockHideLink(string $link) : $this
Parameters
- $link : string
Return values
$this —blockLink()
Block a link.
public
blockLink(string $link) : $this
Parameters
- $link : string
Return values
$this —blockPartialLink()
Block a partial link.
public
blockPartialLink(string $link) : $this
Parameters
- $link : string
Return values
$this —checkNavs()
Determines if there are any navs for the player.
public
checkNavs() : bool
Return values
bool —forestNav()
Create a navigations navs for forest.
public
forestNav(string $translationDomain) : void
Parameters
- $translationDomain : string
Return values
void —gardensNav()
Create a navigations navs for gardens.
public
gardensNav(string $translationDomain) : void
Parameters
- $translationDomain : string
Return values
void —getClassHeader()
Get class name for header.
public
getClassHeader() : string
Return values
string —getClassNav()
Get class name for nav.
public
getClassNav() : string
Return values
string —getDefaultTextDomain()
Get default text domain.
public
getDefaultTextDomain() : string
Return values
string —getHeaders()
Get information of headers.
public
getHeaders() : mixed
Return values
mixed —getLastHeader()
Get the last header created.
public
getLastHeader() : string
Return values
string —getNavigation()
Get structure of navigation.
public
getNavigation() : mixed
Return values
mixed —getNavs()
Get information of navs.
public
getNavs() : mixed
Return values
mixed —getTextDomain()
Get text domain for translator.
public
getTextDomain() : string
Return values
string —graveyardNav()
Create a navigations navs for graveyard.
public
graveyardNav(string $translationDomain) : void
Parameters
- $translationDomain : string
Return values
void —headerHasNavs()
Check if header has navs to show.
public
headerHasNavs(string $label) : bool
Parameters
- $label : string
Return values
bool —isBlocked()
Check if link is blocked.
public
isBlocked(string $link) : bool
Parameters
- $link : string
Return values
bool —isHided()
Check if link is hide.
public
isHided(string $link) : bool
Parameters
- $link : string
Return values
bool —pagination()
Navigation menu used with Paginator.
public
pagination(Paginator $paginator, string $url[, bool|null $forcePages = null ]) : mixed
Parameters
- $paginator : Paginator
- $url : string
- $forcePages : bool|null = null
-
Force to show pages if only have 1 page
Return values
mixed —setClassHeader()
Set class name for header.
public
setClassHeader(string $classHeader) : self
Parameters
- $classHeader : string
-
class name for header
Return values
self —setClassNav()
Set class name for nav.
public
setClassNav(string $classNav) : self
Parameters
- $classNav : string
-
class name for nav
Return values
self —setTextDomain()
Set text domain for translator.
public
setTextDomain([string|null $domain = null ]) : $this
Parameters
- $domain : string|null = null
-
With null reset to previous text domain
Return values
$this —superuser()
Add navs for actions of superuser.
public
superuser() : void
Return values
void —superuserGrottoNav()
Add navs for action of superuser in Grotto page.
public
superuserGrottoNav() : void
Return values
void —townNav()
public
townNav(string $translationDomain) : void
Parameters
- $translationDomain : string
Return values
void —unBlockLink()
Unblock a link.
public
unBlockLink(string $link) : $this
Parameters
- $link : string
Return values
$this —unBlockPartialLink()
Unblock a partial link.
public
unBlockPartialLink(string $link) : $this
Parameters
- $link : string
Return values
$this —villageNav()
Add nav to village/shades.
public
villageNav([string $extra = '' ]) : void
Parameters
- $extra : string = ''
Return values
void —addItem()
Private function to add a nav in navigation menu.
protected
addItem(string|null $label[, string|null $link = null ][, array<string|int, mixed> $options = [] ]) : $this
Parameters
- $label : string|null
- $link : string|null = null
- $options : array<string|int, mixed> = []
Return values
$this —block()
Block a link.
protected
block(string $link, array<string|int, mixed> $options) : self
Parameters
- $link : string
- $options : array<string|int, mixed>
Return values
self —getExtraParamLink()
Get a extra param for link.
protected
getExtraParamLink(string|null $link) : string
Parameters
- $link : string|null
Return values
string —getKeyForNav()
Get key for nav.
protected
getKeyForNav(array<string|int, mixed> $navs, bool $remplace, string $label) : int
Parameters
- $navs : array<string|int, mixed>
- $remplace : bool
- $label : string