Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
MacGyer committed May 21, 2018
1 parent bbb275d commit 97137d1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/widgets/navigation/NavBar.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ public function run()
return implode("\n", $html);
}

/**
* Initializes the side nav options.
*
* @param string $sidenavId the side nav element's HTML id attribute.
*/
protected function initSidenav($sidenavId)
{
$this->sidenavToggleButtonOptions = ArrayHelper::merge([
Expand Down Expand Up @@ -246,6 +251,12 @@ protected function renderSidenav($sidenavId)
]);
}

/**
* Renders the side nav toggle button.
*
* @return string the button markup.
* @throws \Exception
*/
protected function renderSidenavToggleButton()
{
return Button::widget($this->sidenavToggleButtonOptions);
Expand Down
19 changes: 17 additions & 2 deletions src/widgets/navigation/SideNav.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ class SideNav extends Nav
* @var array the configuration options for the toggle button.
* The toggle button is rendered by the [[Button]] widget. See the docs for all available options.
*
*
* @see Button|Button
*/
public $toggleButtonOptions = [];
Expand Down Expand Up @@ -184,6 +183,16 @@ protected function renderItem($item)
return Html::tag('li', $content, $listItemOptions);
}

/**
* Renders a submenu as Collapsible in side navigation element.
*
* @param string $link the trigger link.
* @param array $items the submenu items.
* @param bool $isParentActive whether the submenu's parent list element shall get an 'active' state.
* @return string the Collapsible markup.
*
* @throws \Exception
*/
protected function renderCollapsible($link, $items = [], $isParentActive = false)
{
$itemOptions = [];
Expand All @@ -205,7 +214,13 @@ protected function renderCollapsible($link, $items = [], $isParentActive = false
]);
}

protected function buildCollapsibleBody($items)
/**
* Build the needed markup for the collapsible body, i. e. the `<ul>` containing the submenu links.
*
* @param array $items the submenu items.
* @return string the Collapsible body markup.
*/
protected function buildCollapsibleBody($items = [])
{
$html[] = Html::beginTag('ul');

Expand Down

0 comments on commit 97137d1

Please sign in to comment.