[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/view/control/ -> AphrontTypeaheadTemplateView.php (source)

   1  <?php
   2  
   3  final class AphrontTypeaheadTemplateView extends AphrontView {
   4  
   5    private $value;
   6    private $name;
   7    private $id;
   8  
   9    public function setID($id) {
  10      $this->id = $id;
  11      return $this;
  12    }
  13  
  14    public function setValue(array $value) {
  15      $this->value = $value;
  16      return $this;
  17    }
  18  
  19    public function getValue() {
  20      return $this->value;
  21    }
  22  
  23    public function setName($name) {
  24      $this->name = $name;
  25      return $this;
  26    }
  27  
  28    public function getName() {
  29      return $this->name;
  30    }
  31  
  32    public function render() {
  33      require_celerity_resource('aphront-typeahead-control-css');
  34  
  35      $id = $this->id;
  36      $name = $this->getName();
  37      $values = nonempty($this->getValue(), array());
  38  
  39      $tokens = array();
  40      foreach ($values as $key => $value) {
  41        $tokens[] = $this->renderToken($key, $value);
  42      }
  43  
  44      $input = javelin_tag(
  45        'input',
  46        array(
  47          'name'          => $name,
  48          'class'         => 'jx-typeahead-input',
  49          'sigil'         => 'typeahead',
  50          'type'          => 'text',
  51          'value'         => $this->value,
  52          'autocomplete'  => 'off',
  53        ));
  54  
  55      return javelin_tag(
  56        'div',
  57        array(
  58          'id'    => $id,
  59          'sigil' => 'typeahead-hardpoint',
  60          'class' => 'jx-typeahead-hardpoint',
  61        ),
  62        array(
  63          $input,
  64          phutil_tag('div', array('style' => 'clear: both'), ''),
  65        ));
  66    }
  67  }


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