3 final class PhabricatorFileIconSetSelectController
4 extends PhabricatorFileController
{
6 public function handleRequest(AphrontRequest
$request) {
7 $key = $request->getURIData('key');
9 $set = PhabricatorIconSet
::getIconSetByKey($key);
11 return new Aphront404Response();
14 $v_icon = $request->getStr('icon');
15 if ($request->isFormPost()) {
16 $icon = $set->getIcon($v_icon);
20 'value' => $icon->getKey(),
21 'display' => $set->renderIconForControl($icon),
24 return id(new AphrontAjaxResponse())
25 ->setContent($payload);
29 require_celerity_resource('phui-icon-set-selector-css');
30 Javelin
::initBehavior('phabricator-tooltips');
34 $breakpoint = ceil(sqrt(count($set->getIcons())));
35 foreach ($set->getIcons() as $icon) {
36 $label = $icon->getLabel();
38 $view = id(new PHUIIconView())
39 ->setIcon($icon->getIcon());
42 $classes[] = 'icon-button';
44 $is_selected = ($icon->getKey() == $v_icon);
47 $classes[] = 'selected';
50 $is_disabled = $icon->getIsDisabled();
51 if ($is_disabled && !$is_selected) {
60 pht('Choose "%s" Icon', $label));
62 $buttons[] = javelin_tag(
65 'class' => implode(' ', $classes),
67 'value' => $icon->getKey(),
69 'sigil' => 'has-tooltip',
79 if ((++
$ii %
$breakpoint) == 0) {
80 $buttons[] = phutil_tag('br');
84 $buttons = phutil_tag(
87 'class' => 'icon-grid',
91 $dialog_title = $set->getSelectIconTitleText();
93 return $this->newDialog()
94 ->setTitle($dialog_title)
95 ->appendChild($buttons)
96 ->addCancelButton('/');