Changeset View
Changeset View
Standalone View
Standalone View
src/view/phui/PHUIListView.php
| <?php | <?php | ||||
| final class PHUIListView extends AphrontTagView { | final class PHUIListView extends AphrontTagView { | ||||
| const NAVBAR_LIST = 'phui-list-navbar'; | const NAVBAR_LIST = 'phui-list-navbar'; | ||||
| const NAVBAR_VERTICAL = 'phui-list-navbar-vertical'; | |||||
| const SIDENAV_LIST = 'phui-list-sidenav'; | const SIDENAV_LIST = 'phui-list-sidenav'; | ||||
| const TABBAR_LIST = 'phui-list-tabbar'; | const TABBAR_LIST = 'phui-list-tabbar'; | ||||
| private $items = array(); | private $items = array(); | ||||
| private $type; | private $type; | ||||
| protected function canAppendChild() { | protected function canAppendChild() { | ||||
| return false; | return false; | ||||
| ▲ Show 20 Lines • Show All 161 Lines • ▼ Show 20 Lines | public function setType($type) { | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| protected function getTagAttributes() { | protected function getTagAttributes() { | ||||
| require_celerity_resource('phui-list-view-css'); | require_celerity_resource('phui-list-view-css'); | ||||
| $classes = array(); | $classes = array(); | ||||
| $classes[] = 'phui-list-view'; | $classes[] = 'phui-list-view'; | ||||
| if ($this->type) { | if ($this->type) { | ||||
| switch ($this->type) { | |||||
| case self::NAVBAR_LIST: | |||||
| $classes[] = 'phui-list-navbar'; | |||||
| $classes[] = 'phui-list-navbar-horizontal'; | |||||
| break; | |||||
| case self::NAVBAR_VERTICAL: | |||||
| $classes[] = 'phui-list-navbar'; | |||||
| $classes[] = 'phui-list-navbar-vertical'; | |||||
| break; | |||||
| default: | |||||
| $classes[] = $this->type; | $classes[] = $this->type; | ||||
| break; | |||||
| } | } | ||||
| } | |||||
| return array( | return array( | ||||
| 'class' => implode(' ', $classes), | 'class' => implode(' ', $classes), | ||||
| ); | ); | ||||
| } | } | ||||
| protected function getTagContent() { | protected function getTagContent() { | ||||
| return $this->items; | return $this->items; | ||||
| } | } | ||||
| } | } | ||||