Exemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 protected function configure()
 {
     // default precision is locale specific (usually around 3)
     $this->addOption('precision');
     $this->addOption('grouping', false);
     $this->addOption('rounding-mode', NumberToLocalizedStringTransformer::ROUND_HALFUP);
     parent::configure();
     $this->setValueTransformer(new NumberToLocalizedStringTransformer(array('precision' => $this->getOption('precision'), 'grouping' => $this->getOption('grouping'), 'rounding-mode' => $this->getOption('rounding-mode'))));
 }
Exemplo n.º 2
0
 /**
  * {@inheritDoc}
  */
 public function render(array $attributes = array())
 {
     $html = parent::render(array_merge(array('value' => $this->getOption('value'), 'checked' => (string) $this->getDisplayedData() !== '' && $this->getDisplayedData() !== 0), $attributes));
     if ($label = $this->getOption('label')) {
         if ($this->getOption('translate_label')) {
             $label = $this->translate($label);
         }
         $html .= ' ' . $this->generator->contentTag('label', $label, array('for' => $this->getId()));
     }
     return $html;
 }
Exemplo n.º 3
0
 /**
  * {@inheritDoc}
  */
 public function render(array $attributes = array())
 {
     return parent::render(array_merge(array('type' => 'text'), $attributes));
 }
Exemplo n.º 4
0
 /**
  * {@inheritDoc}
  */
 public function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('value' => $this->getOption('value'), 'checked' => (string) $this->getDisplayedData() !== '' && $this->getDisplayedData() !== 0));
 }
 /**
  * {@inheritDoc}
  */
 public function __construct($key, array $options = array())
 {
     $options['type'] = 'text';
     parent::__construct($key, $options);
 }
Exemplo n.º 6
0
 /**
  * {@inheritDoc}
  */
 public function render(array $attributes = array())
 {
     return parent::render(array_merge(array('type' => 'text', 'maxlength' => $this->getOption('max_length')), $attributes));
 }
Exemplo n.º 7
0
 /**
  * {@inheritDoc}
  */
 public function getAttributes(array $attributes = array())
 {
     return array_merge(parent::getAttributes(), array('type' => 'text'));
 }