Changeset View
Changeset View
Standalone View
Standalone View
src/view/phui/PHUITabView.php
| <?php | <?php | ||||
| final class PHUITabView extends AphrontTagView { | final class PHUITabView extends AphrontTagView { | ||||
| private $icon; | |||||
| private $name; | private $name; | ||||
| private $key; | private $key; | ||||
| private $keyLocked; | private $keyLocked; | ||||
| private $contentID; | private $contentID; | ||||
| private $color; | private $color; | ||||
| public function setKey($key) { | public function setKey($key) { | ||||
| if ($this->keyLocked) { | if ($this->keyLocked) { | ||||
| Show All 33 Lines | public function setName($name) { | ||||
| $this->name = $name; | $this->name = $name; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getName() { | public function getName() { | ||||
| return $this->name; | return $this->name; | ||||
| } | } | ||||
| public function setIcon(PHUIIconView $icon) { | |||||
| $this->icon = $icon; | |||||
| return $this; | |||||
| } | |||||
| public function getIcon() { | |||||
| return $this->icon; | |||||
| } | |||||
| public function getContentID() { | public function getContentID() { | ||||
| if ($this->contentID === null) { | if ($this->contentID === null) { | ||||
| $this->contentID = celerity_generate_unique_node_id(); | $this->contentID = celerity_generate_unique_node_id(); | ||||
| } | } | ||||
| return $this->contentID; | return $this->contentID; | ||||
| } | } | ||||
| Show All 13 Lines | $item = id(new PHUIListItemView()) | ||||
| ->setType(PHUIListItemView::TYPE_LINK) | ->setType(PHUIListItemView::TYPE_LINK) | ||||
| ->setHref('#') | ->setHref('#') | ||||
| ->addSigil('phui-tab-view') | ->addSigil('phui-tab-view') | ||||
| ->setMetadata( | ->setMetadata( | ||||
| array( | array( | ||||
| 'tabKey' => $this->getKey(), | 'tabKey' => $this->getKey(), | ||||
| )); | )); | ||||
| $icon = $this->getIcon(); | |||||
| if ($icon) { | |||||
| $item->setIcon($icon->getIconName()); | |||||
| } | |||||
| $color = $this->getColor(); | $color = $this->getColor(); | ||||
| if ($color !== null) { | if ($color !== null) { | ||||
| $item->setStatusColor($color); | $item->setStatusColor($color); | ||||
| } | } | ||||
| return $item; | return $item; | ||||
| } | } | ||||
| } | } | ||||