mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-13 18:32:41 +01:00
46 lines
1 KiB
PHP
46 lines
1 KiB
PHP
|
<?php
|
||
|
|
||
|
final class PhabricatorButtonsExample extends PhabricatorUIExample {
|
||
|
|
||
|
public function getName() {
|
||
|
return 'Buttons';
|
||
|
}
|
||
|
|
||
|
public function getDescription() {
|
||
|
return 'Use <tt><button></tt> to render buttons.';
|
||
|
}
|
||
|
|
||
|
public function renderExample() {
|
||
|
$request = $this->getRequest();
|
||
|
$user = $request->getUser();
|
||
|
|
||
|
$colors = array('', 'green', 'grey', 'disabled');
|
||
|
$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';
|
||
|
}
|
||
|
|
||
|
$view[] = phutil_render_tag(
|
||
|
$tag,
|
||
|
array(
|
||
|
'class' => $class,
|
||
|
),
|
||
|
phutil_escape_html(ucwords($size.' '.$color.' '.$tag)));
|
||
|
|
||
|
$view[] = '<br /><br />';
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return '<div style="margin: 1em 2em;">'.implode('', $view).'</div>';
|
||
|
}
|
||
|
}
|