Changeset View
Changeset View
Standalone View
Standalone View
src/applications/uiexample/examples/MacroEmojiExample.php
Show All 10 Lines | final class MacroEmojiExample extends PhabricatorUIExample { | ||||
} | } | ||||
public function getCategory() { | public function getCategory() { | ||||
return pht('Catalogs'); | return pht('Catalogs'); | ||||
} | } | ||||
public function renderExample() { | public function renderExample() { | ||||
$raw = id(new PhabricatorEmojiRemarkupRule()) | $manifest = id(new PhabricatorEmojiRemarkupRule()) | ||||
->markupEmojiJSON(); | ->getEmojiManifest(); | ||||
$json = phutil_json_decode($raw); | |||||
$content = array(); | $content = array(); | ||||
foreach ($json as $shortname => $hex) { | foreach ($manifest as $shortname => $spec) { | ||||
$display_name = ' '.$spec['emoji'].' '.$shortname; | |||||
$display_name = ' '.$hex.' '.$shortname; | |||||
$content[] = phutil_tag( | $content[] = phutil_tag( | ||||
'div', | 'div', | ||||
array( | array( | ||||
'class' => 'ms grouped', | 'class' => 'ms grouped', | ||||
'style' => 'width: 240px; height: 24px; float: left;', | 'style' => 'width: 240px; height: 24px; float: left;', | ||||
), | ), | ||||
$display_name); | $display_name); | ||||
} | } | ||||
$wrap = id(new PHUIObjectBoxView()) | $wrap = id(new PHUIObjectBoxView()) | ||||
->setHeaderText(pht('Emojis')) | ->setHeaderText(pht('Emojis')) | ||||
->addClass('grouped') | ->addClass('grouped') | ||||
->appendChild($content); | ->appendChild($content); | ||||
return phutil_tag( | return phutil_tag( | ||||
'div', | 'div', | ||||
array(), | array(), | ||||
array( | array( | ||||
$wrap, | $wrap, | ||||
)); | )); | ||||
} | } | ||||
} | } |