[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/view/form/control/ -> PHUIFormMultiSubmitControl.php (source)

   1  <?php
   2  
   3  final class PHUIFormMultiSubmitControl extends AphrontFormControl {
   4  
   5    private $buttons = array();
   6  
   7    public function addBackButton($label = null) {
   8      if ($label === null) {
   9        $label = pht("\xC2\xAB Back");
  10      }
  11      return $this->addButton('__back__', $label, 'grey');
  12    }
  13  
  14    public function addSubmitButton($label) {
  15      return $this->addButton('__submit__', $label);
  16    }
  17  
  18    public function addCancelButton($uri, $label = null) {
  19      if ($label === null) {
  20        $label = pht('Cancel');
  21      }
  22  
  23      $this->buttons[] = phutil_tag(
  24        'a',
  25        array(
  26          'class' => 'grey button',
  27          'href' => $uri,
  28        ),
  29        $label);
  30  
  31      return $this;
  32    }
  33  
  34    public function addButtonView(PHUIButtonView $button) {
  35      $this->buttons[] = $button;
  36      return $this;
  37    }
  38  
  39    public function addButton($name, $label, $class = null) {
  40      $this->buttons[] = javelin_tag(
  41        'input',
  42        array(
  43          'type'  => 'submit',
  44          'name'  => $name,
  45          'value' => $label,
  46          'class' => $class,
  47          'sigil' => 'alternate-submit-button',
  48          'disabled' => $this->getDisabled() ? 'disabled' : null,
  49        ));
  50      return $this;
  51    }
  52  
  53    protected function getCustomControlClass() {
  54      return 'phui-form-control-multi-submit';
  55    }
  56  
  57    protected function renderInput() {
  58      return array_reverse($this->buttons);
  59    }
  60  
  61  }


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