Changeset View
Changeset View
Standalone View
Standalone View
src/view/layout/AphrontSideNavFilterView.php
Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | return $this->addThing( | ||||
$key, $name, $uri, PHUIListItemView::TYPE_BUTTON); | $key, $name, $uri, PHUIListItemView::TYPE_BUTTON); | ||||
} | } | ||||
public function newLink($key) { | public function newLink($key) { | ||||
$this->addFilter($key, ''); | $this->addFilter($key, ''); | ||||
return $this->getMenuView()->getItem($key); | return $this->getMenuView()->getItem($key); | ||||
} | } | ||||
/** | |||||
* Add a thing in the menu | |||||
* | |||||
* @param string $key Internal name | |||||
* @param string $name Human name | |||||
* @param mixed $uri Destination URI. For example as string or as PhutilURI. | |||||
* @param string $type Item type. For example see PHUIListItemView constants. | |||||
* @param string $icon Icon name | |||||
*/ | |||||
private function addThing($key, $name, $uri, $type, $icon = null) { | private function addThing($key, $name, $uri, $type, $icon = null) { | ||||
$item = id(new PHUIListItemView()) | $item = id(new PHUIListItemView()) | ||||
->setName($name) | ->setName($name) | ||||
->setType($type); | ->setType($type); | ||||
if (strlen($icon)) { | if (phutil_nonempty_string($icon)) { | ||||
valerio.bozzolan: ✅ I tested with `phlog()` and it seems `$item` is just the string name of Font Awesome icon, or… | |||||
$item->setIcon($icon); | $item->setIcon($icon); | ||||
} | } | ||||
if (strlen($key)) { | if (strlen($key)) { | ||||
$item->setKey($key); | $item->setKey($key); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 164 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
✅ I tested with phlog() and it seems $item is just the string name of Font Awesome icon, or null.
The phutil_nonempty_string() will report alien values and that is OK.