mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-11 14:28:31 +01:00
Summary: This moves the outer classes to the outmost div Test Plan: Reviewed a few PHUIBox pages Reviewers: epriestley Reviewed By: epriestley CC: Korvin, aran Differential Revision: https://secure.phabricator.com/D6902
66 lines
1.3 KiB
PHP
66 lines
1.3 KiB
PHP
<?php
|
|
|
|
final class PHUIBoxView extends AphrontTagView {
|
|
|
|
private $margin = array();
|
|
private $padding = array();
|
|
private $shadow = false;
|
|
private $border = false;
|
|
|
|
public function addMargin($margin) {
|
|
$this->margin[] = $margin;
|
|
return $this;
|
|
}
|
|
|
|
public function addPadding($padding) {
|
|
$this->padding[] = $padding;
|
|
return $this;
|
|
}
|
|
|
|
public function setShadow($shadow) {
|
|
$this->shadow = $shadow;
|
|
return $this;
|
|
}
|
|
|
|
public function setBorder($border) {
|
|
$this->border = $border;
|
|
return $this;
|
|
}
|
|
|
|
protected function getTagAttributes() {
|
|
$outer_classes = array();
|
|
$outer_classes[] = 'phui-box';
|
|
if ($this->shadow) {
|
|
$outer_classes[] = 'phui-box-shadow';
|
|
}
|
|
if ($this->border) {
|
|
$outer_classes[] = 'phui-box-border';
|
|
}
|
|
foreach ($this->margin as $margin) {
|
|
$outer_classes[] = $margin;
|
|
}
|
|
|
|
return array('class' => $outer_classes);
|
|
}
|
|
|
|
public function getTagName() {
|
|
return 'div';
|
|
}
|
|
|
|
public function getTagContent() {
|
|
require_celerity_resource('phui-box-css');
|
|
|
|
$inner_classes = array();
|
|
$inner_classes[] = 'phui-box-inner';
|
|
foreach ($this->padding as $padding) {
|
|
$inner_classes[] = $padding;
|
|
}
|
|
|
|
return phutil_tag(
|
|
'div',
|
|
array(
|
|
'class' => implode(' ', $inner_classes)
|
|
),
|
|
$this->renderChildren());
|
|
}
|
|
}
|