Changeset View
Changeset View
Standalone View
Standalone View
src/view/phui/PHUIListItemView.php
Show All 19 Lines | final class PHUIListItemView extends AphrontTagView { | ||||
private $key; | private $key; | ||||
private $icon; | private $icon; | ||||
private $appIcon; | private $appIcon; | ||||
private $selected; | private $selected; | ||||
private $disabled; | private $disabled; | ||||
private $renderNameAsTooltip; | private $renderNameAsTooltip; | ||||
private $statusColor; | private $statusColor; | ||||
private $order; | private $order; | ||||
private $aural; | |||||
public function setAural($aural) { | |||||
$this->aural = $aural; | |||||
return $this; | |||||
} | |||||
public function getAural() { | |||||
return $this->aural; | |||||
} | |||||
public function setOrder($order) { | public function setOrder($order) { | ||||
$this->order = $order; | $this->order = $order; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getOrder() { | public function getOrder() { | ||||
return $this->order; | return $this->order; | ||||
▲ Show 20 Lines • Show All 129 Lines • ▼ Show 20 Lines | if ($this->name) { | ||||
'tip' => $this->name, | 'tip' => $this->name, | ||||
); | ); | ||||
} else { | } else { | ||||
$external = null; | $external = null; | ||||
if ($this->isExternal) { | if ($this->isExternal) { | ||||
$external = " \xE2\x86\x97"; | $external = " \xE2\x86\x97"; | ||||
} | } | ||||
// If this element has an aural representation, make any name visual | |||||
// only. This is primarily dealing with the links in the main menu like | |||||
// "Profile" and "Logout". If we don't hide the name, the mobile | |||||
// version of these elements will have two redundant names. | |||||
$classes = array(); | |||||
$classes[] = 'phui-list-item-name'; | |||||
if ($this->aural !== null) { | |||||
$classes[] = 'visual-only'; | |||||
} | |||||
$name = phutil_tag( | $name = phutil_tag( | ||||
'span', | 'span', | ||||
array( | array( | ||||
'class' => 'phui-list-item-name', | 'class' => implode(' ', $classes), | ||||
), | ), | ||||
array( | array( | ||||
$this->name, | $this->name, | ||||
$external, | $external, | ||||
)); | )); | ||||
} | } | ||||
} | } | ||||
$aural = null; | |||||
if ($this->aural !== null) { | |||||
$aural = phutil_tag( | |||||
'span', | |||||
array( | |||||
'class' => 'aural-only', | |||||
), | |||||
$this->aural); | |||||
} | |||||
if ($this->icon) { | if ($this->icon) { | ||||
$icon_name = $this->icon; | $icon_name = $this->icon; | ||||
if ($this->getDisabled()) { | if ($this->getDisabled()) { | ||||
$icon_name .= '-grey'; | $icon_name .= '-grey'; | ||||
} | } | ||||
$icon = id(new PHUIIconView()) | $icon = id(new PHUIIconView()) | ||||
->addClass('phui-list-item-icon') | ->addClass('phui-list-item-icon') | ||||
Show All 12 Lines | return javelin_tag( | ||||
$this->href ? 'a' : 'div', | $this->href ? 'a' : 'div', | ||||
array( | array( | ||||
'href' => $this->href, | 'href' => $this->href, | ||||
'class' => $this->href ? 'phui-list-item-href' : null, | 'class' => $this->href ? 'phui-list-item-href' : null, | ||||
'meta' => $meta, | 'meta' => $meta, | ||||
'sigil' => $sigil, | 'sigil' => $sigil, | ||||
), | ), | ||||
array( | array( | ||||
$aural, | |||||
$icon, | $icon, | ||||
$this->renderChildren(), | $this->renderChildren(), | ||||
$name, | $name, | ||||
)); | )); | ||||
} | } | ||||
} | } |