Changeset View
Changeset View
Standalone View
Standalone View
src/view/form/PHUIInfoView.php
| <?php | <?php | ||||
| final class PHUIInfoView extends AphrontView { | final class PHUIInfoView extends AphrontView { | ||||
| const SEVERITY_ERROR = 'error'; | const SEVERITY_ERROR = 'error'; | ||||
| const SEVERITY_WARNING = 'warning'; | const SEVERITY_WARNING = 'warning'; | ||||
| const SEVERITY_NOTICE = 'notice'; | const SEVERITY_NOTICE = 'notice'; | ||||
| const SEVERITY_NODATA = 'nodata'; | const SEVERITY_NODATA = 'nodata'; | ||||
| const SEVERITY_SUCCESS = 'success'; | const SEVERITY_SUCCESS = 'success'; | ||||
| private $title; | private $title; | ||||
| private $errors; | private $errors; | ||||
| private $severity; | private $severity; | ||||
| private $id; | private $id; | ||||
| private $buttons = array(); | private $buttons = array(); | ||||
| private $isHidden; | private $isHidden; | ||||
| private $flush; | |||||
| public function setTitle($title) { | public function setTitle($title) { | ||||
| $this->title = $title; | $this->title = $title; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function setSeverity($severity) { | public function setSeverity($severity) { | ||||
| $this->severity = $severity; | $this->severity = $severity; | ||||
| Show All 10 Lines | public function setID($id) { | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function setIsHidden($bool) { | public function setIsHidden($bool) { | ||||
| $this->isHidden = $bool; | $this->isHidden = $bool; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function setFlush($flush) { | |||||
| $this->flush = $flush; | |||||
| return $this; | |||||
| } | |||||
| public function addButton(PHUIButtonView $button) { | public function addButton(PHUIButtonView $button) { | ||||
| $this->buttons[] = $button; | $this->buttons[] = $button; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function render() { | public function render() { | ||||
| require_celerity_resource('phui-info-view-css'); | require_celerity_resource('phui-info-view-css'); | ||||
| Show All 31 Lines | public function render() { | ||||
| } | } | ||||
| $this->severity = nonempty($this->severity, self::SEVERITY_ERROR); | $this->severity = nonempty($this->severity, self::SEVERITY_ERROR); | ||||
| $classes = array(); | $classes = array(); | ||||
| $classes[] = 'phui-info-view'; | $classes[] = 'phui-info-view'; | ||||
| $classes[] = 'phui-info-severity-'.$this->severity; | $classes[] = 'phui-info-severity-'.$this->severity; | ||||
| $classes[] = 'grouped'; | $classes[] = 'grouped'; | ||||
| if ($this->flush) { | |||||
| $classes[] = 'phui-info-view-flush'; | |||||
| } | |||||
| $classes = implode(' ', $classes); | $classes = implode(' ', $classes); | ||||
| $children = $this->renderChildren(); | $children = $this->renderChildren(); | ||||
| if ($list) { | if ($list) { | ||||
| $children[] = $list; | $children[] = $list; | ||||
| } | } | ||||
| $body = null; | $body = null; | ||||
| Show All 33 Lines | |||||