1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-25 06:50:55 +01:00

Allow sidenav to have custom classes on items

Summary:
I need this to set "disabled" on some menu items that are policy-restricted.

NOTE: This is getting gross and I promise to clean it up with the new side nav stuff.

Test Plan: Added "Disabled" to some items, they became disabeld.

Reviewers: vrana, btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T603

Differential Revision: https://secure.phabricator.com/D3203
This commit is contained in:
epriestley 2012-08-09 09:44:58 -07:00
parent b86d995b40
commit 57a0722636

View file

@ -53,9 +53,22 @@ final class AphrontSideNavFilterView extends AphrontView {
return $this; return $this;
} }
public function addFilter($key, $name, $uri = null, $relative = false) { public function addFilter(
$key,
$name,
$uri = null,
$relative = false,
$class = null) {
$this->items[] = array( $this->items[] = array(
'filter', $key, $name, 'uri' => $uri, 'relative' => $relative); 'filter',
$key,
$name,
'uri' => $uri,
'relative' => $relative,
'class' => $class,
);
return $this; return $this;
} }
@ -134,6 +147,8 @@ final class AphrontSideNavFilterView extends AphrontView {
? 'aphront-side-nav-selected' ? 'aphront-side-nav-selected'
: null; : null;
$class = trim($class.' '.idx($item, 'class', ''));
if (empty($item['uri'])) { if (empty($item['uri'])) {
$href = clone $this->baseURI; $href = clone $this->baseURI;
$href->setPath($href->getPath().$key.'/'); $href->setPath($href->getPath().$key.'/');