2012-11-08 17:22:08 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorButtonsExample extends PhabricatorUIExample {
|
|
|
|
|
|
|
|
public function getName() {
|
|
|
|
return 'Buttons';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDescription() {
|
2013-02-08 21:07:44 +01:00
|
|
|
return hsprintf('Use <tt><button></tt> to render buttons.');
|
2012-11-08 17:22:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function renderExample() {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$user = $request->getUser();
|
|
|
|
|
2012-11-09 00:47:11 +01:00
|
|
|
$colors = array('', 'green', 'grey', 'black', 'disabled');
|
2012-11-08 17:22:08 +01:00
|
|
|
$sizes = array('', 'small');
|
|
|
|
$tags = array('a', 'button');
|
|
|
|
|
|
|
|
$view = array();
|
|
|
|
foreach ($tags as $tag) {
|
|
|
|
foreach ($colors as $color) {
|
|
|
|
foreach ($sizes as $size) {
|
|
|
|
$class = implode(' ', array($color, $size));
|
|
|
|
|
|
|
|
if ($tag == 'a') {
|
|
|
|
$class .= ' button';
|
|
|
|
}
|
|
|
|
|
2013-01-18 03:43:35 +01:00
|
|
|
$view[] = phutil_tag(
|
2012-11-08 17:22:08 +01:00
|
|
|
$tag,
|
|
|
|
array(
|
|
|
|
'class' => $class,
|
|
|
|
),
|
2013-01-18 03:43:35 +01:00
|
|
|
ucwords($size.' '.$color.' '.$tag));
|
2012-11-08 17:22:08 +01:00
|
|
|
|
|
|
|
$view[] = '<br /><br />';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return '<div style="margin: 1em 2em;">'.implode('', $view).'</div>';
|
|
|
|
}
|
|
|
|
}
|