Class dmitrybtn\yimp\Navigator

Inheritancedmitrybtn\yimp\Navigator » yii\base\BaseObject

Base class to pass data from controller to layout.

Navigator has the following properties, used in layout:

  • brand: Application name, displayed as brand label in navbar. It is Yii::$app->name by default.
  • title: Page name, displayed as <title> tag. It is ucfirst(Yii::$app->controller->action->id) by default. This property is also used as default value for header, headerMobile, and headerCrumb properties.
  • headerDesktop: Page name, displayed as <h1> on desktops. If false, <h1> will not be displayed.
  • headerMobile: Page name, displayed in navbar on mobiles.
  • headerCrumb: Last part of breadcrumbs, representing current page title. If false, it will not be displayed.
  • menuLeft: left menu config, represented by yii\bootstrap4\Nav::items with additional functionality, provided by dmitrybtn\yimp\MenuAdapter.
  • menuRight: right menu config, represented by yii\bootstrap4\Nav::items with additional functionality, provided by dmitrybtn\yimp\MenuAdapter.
  • menuTop: top menu config, represented by yii\bootstrap4\Nav::items with additional functionality, provided by dmitrybtn\yimp\MenuAdapter.
  • crumbs: Breadcrumbs config, represented by yii\bootstrap4\Breadcrumbs::links property, without last item, which is taken from headerCrumb property.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$crumbs array|false Breadcrumbs config, passed to Breadcrumbs widget. dmitrybtn\yimp\Navigator
$menuLeft array Left menu config Left menu is rendered in left sidebar on desktops and in left slider on mobiles. dmitrybtn\yimp\Navigator
$menuRight array Right Right menu is rendered in right sidebar on desktops and in right slider on mobiles. dmitrybtn\yimp\Navigator
$menuTop array Left menu config, rendered by dmitrybtn\yimp\MenuAdapter. dmitrybtn\yimp\Navigator

Public Methods

Hide inherited methods

MethodDescriptionDefined By
getBrand() Getter for brand property dmitrybtn\yimp\Navigator
getHeaderCrumb() Getter for headerCrumb property, used to render header last part of breadcrumbs dmitrybtn\yimp\Navigator
getHeaderDesktop() Getter for headerDesktop property, used to render <h1> tag on desktops. dmitrybtn\yimp\Navigator
getHeaderMobile() Getter for headerMobile property, used to render header in navbar on mobiles. dmitrybtn\yimp\Navigator
getTitle() Getter for title property, used to render <title> tag. dmitrybtn\yimp\Navigator
setBrand() Setter fot brand property dmitrybtn\yimp\Navigator
setHeaderCrumb() Getter for headerCrumb property dmitrybtn\yimp\Navigator
setHeaderDesktop() Setter for headerDesktop property dmitrybtn\yimp\Navigator
setHeaderMobile() Setter for headerMobile property dmitrybtn\yimp\Navigator
setTitle() Setter fot title property dmitrybtn\yimp\Navigator

Property Details

$_brand protected property
protected $_brand null
$_headerCrumb protected property
protected $_headerCrumb null
$_headerDesktop protected property
protected $_headerDesktop null
$_headerMobile protected property
protected $_headerMobile null
$_title protected property
protected $_title null
$crumbs public property

Breadcrumbs config, passed to Breadcrumbs widget.

If it is false, breadcrumbs will not be rendered.

public array|false $crumbs = []
$menuLeft public property

Left menu config

Left menu is rendered in left sidebar on desktops and in left slider on mobiles. It is adapted by dmitrybtn\yimp\MenuAdapter and rendered by dmitrybtn\yimp\widgets\Menu. It is recommended to use left menu as main menu of your application and config it in your implementation of dmitrybtn\yimp\Navigator class.

public array $menuLeft = []
$menuRight public property

Right

Right menu is rendered in right sidebar on desktops and in right slider on mobiles. It is adapted by dmitrybtn\yimp\MenuAdapter and rendered by dmitrybtn\yimp\widgets\Menu. It is recommended to use it as context menu and config it in actions.

public array $menuRight = []
$menuTop public property

Left menu config, rendered by dmitrybtn\yimp\MenuAdapter.

Top menu is rendered in navbar on desktops and in left slider (after left menu) on mobiles. It is adapted by dmitrybtn\yimp\MenuAdapter and rendered by dmitrybtn\yimp\widgets\Menu. It is recommended to use it to user-specific options (Login, Logout, Profile settings and others) and configure it in your implementation of dmitrybtn\yimp\Navigator class.

public array $menuTop = []

Method Details

getBrand() public method

Getter for brand property

If brand property was not set by setBrand(), Yii::$app->name will be returned.

public string getBrand ( )
return string

Brand label

getHeaderCrumb() public method

Getter for headerCrumb property, used to render header last part of breadcrumbs

If headerCrumb property was not setted by setHeaderCrumb(), getTitle() will be returned.

public string getHeaderCrumb ( )
getHeaderDesktop() public method

Getter for headerDesktop property, used to render <h1> tag on desktops.

If headerDesktop property was not setted by setHeaderDesktop(), getTitle() will be returned. If headerDesktop property is false, <h1> tag will not be rendered.

public string|false getHeaderDesktop ( )
getHeaderMobile() public method

Getter for headerMobile property, used to render header in navbar on mobiles.

If headerMobile property was not setted by setHeaderMobile(), getTitle() will be returned.

public string getHeaderMobile ( )
getTitle() public method

Getter for title property, used to render <title> tag.

If title property was not set by setTitle(), current action index will be returned.

public string getTitle ( )
return string

Page title

setBrand() public method

Setter fot brand property

public void setBrand ( \dmitrybtn\yimp\string $brand )
$brand string
setHeaderCrumb() public method

Getter for headerCrumb property

public void setHeaderCrumb ( $headerCrumb )
$headerCrumb string
setHeaderDesktop() public method

Setter for headerDesktop property

public void setHeaderDesktop ( $header )
$header string|false
setHeaderMobile() public method

Setter for headerMobile property

public void setHeaderMobile ( $headerMobile )
$headerMobile string
setTitle() public method

Setter fot title property

public void setTitle ( \dmitrybtn\yimp\string $title )
$title string