[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/uiexample/examples/ -> PHUITextExample.php (source)

   1  <?php
   2  
   3  final class PHUITextExample extends PhabricatorUIExample {
   4  
   5    public function getName() {
   6      return 'Text';
   7    }
   8  
   9    public function getDescription() {
  10      return 'Simple styles for displaying text.';
  11    }
  12  
  13    public function renderExample() {
  14  
  15      $color1 = 'This is RED. ';
  16      $color2 = 'This is ORANGE. ';
  17      $color3 = 'This is YELLOW. ';
  18      $color4 = 'This is GREEN. ';
  19      $color5 = 'This is BLUE. ';
  20      $color6 = 'This is INDIGO. ';
  21      $color7 = 'This is VIOLET. ';
  22      $color8 = 'This is WHITE. ';
  23      $color9 = 'This is BLACK. ';
  24  
  25      $text1 = 'This is BOLD. ';
  26      $text2 = 'This is Uppercase. ';
  27      $text3 = 'This is Stricken.';
  28  
  29      $content =
  30        array(
  31          id(new PHUITextView())
  32            ->setText($color1)
  33            ->addClass(PHUI::TEXT_RED),
  34          id(new PHUITextView())
  35            ->setText($color2)
  36            ->addClass(PHUI::TEXT_ORANGE),
  37          id(new PHUITextView())
  38            ->setText($color3)
  39            ->addClass(PHUI::TEXT_YELLOW),
  40          id(new PHUITextView())
  41            ->setText($color4)
  42            ->addClass(PHUI::TEXT_GREEN),
  43          id(new PHUITextView())
  44            ->setText($color5)
  45            ->addClass(PHUI::TEXT_BLUE),
  46          id(new PHUITextView())
  47            ->setText($color6)
  48            ->addClass(PHUI::TEXT_INDIGO),
  49          id(new PHUITextView())
  50            ->setText($color7)
  51            ->addClass(PHUI::TEXT_VIOLET),
  52          id(new PHUITextView())
  53            ->setText($color8)
  54            ->addClass(PHUI::TEXT_WHITE),
  55          id(new PHUITextView())
  56            ->setText($color9)
  57            ->addClass(PHUI::TEXT_BLACK),
  58        );
  59  
  60      $content2 =
  61        array(
  62          id(new PHUITextView())
  63            ->setText($text1)
  64            ->addClass(PHUI::TEXT_BOLD),
  65          id(new PHUITextView())
  66            ->setText($text2)
  67            ->addClass(PHUI::TEXT_UPPERCASE),
  68          id(new PHUITextView())
  69            ->setText($text3)
  70            ->addClass(PHUI::TEXT_STRIKE),
  71        );
  72  
  73      $layout1 = id(new PHUIBoxView())
  74        ->appendChild($content)
  75              ->setBorder(true)
  76        ->addPadding(PHUI::PADDING_MEDIUM);
  77  
  78      $head1 = id(new PHUIHeaderView())
  79        ->setHeader(pht('Basic Colors'));
  80  
  81      $wrap1 = id(new PHUIBoxView())
  82        ->appendChild($layout1)
  83        ->addMargin(PHUI::MARGIN_LARGE);
  84  
  85      $layout2 = id(new PHUIBoxView())
  86        ->appendChild($content2)
  87        ->setBorder(true)
  88        ->addPadding(PHUI::PADDING_MEDIUM);
  89  
  90      $head2 = id(new PHUIHeaderView())
  91        ->setHeader(pht('Basic Transforms'));
  92  
  93      $wrap2 = id(new PHUIBoxView())
  94        ->appendChild($layout2)
  95        ->addMargin(PHUI::MARGIN_LARGE);
  96  
  97      return phutil_tag(
  98        'div',
  99          array(),
 100          array(
 101            $head1,
 102            $wrap1,
 103            $head2,
 104            $wrap2,
 105          ));
 106    }
 107  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1