Пример #1
0
 public function testRenderWithGrouping()
 {
     $field = new NumberField('name', array('grouping' => true));
     $field->setLocale('de_AT');
     $field->setData(1234.5678);
     $html = '<input id="name" name="name" value="1.234,568" type="text" />';
     $this->assertEquals($html, $field->render());
 }
Пример #2
0
 /**
  * {@inheritDoc}
  */
 protected function configure()
 {
     $this->addOption('precision', 0);
     $this->addOption('percent_type', self::FRACTIONAL);
     parent::configure();
     $this->setValueTransformer(new PercentToLocalizedStringTransformer(array('precision' => $this->getOption('precision'), 'type' => $this->getOption('percent_type'))));
 }
Пример #3
0
 /**
  * {@inheritDoc}
  */
 protected function configure()
 {
     $this->addOption('precision', 2);
     $this->addOption('divisor', 1);
     $this->addOption('currency');
     parent::configure();
     $this->setValueTransformer(new MoneyToLocalizedStringTransformer(array('precision' => $this->getOption('precision'), 'grouping' => $this->getOption('grouping'), 'divisor' => $this->getOption('divisor'))));
 }
Пример #4
0
 /**
  * {@inheritDoc}
  */
 public function render(array $attributes = array())
 {
     $input = parent::render($attributes);
     if ($this->getOption('currency')) {
         return str_replace('%widget%', $input, $this->getPattern($this->locale, $this->getOption('currency')));
     } else {
         return $input;
     }
 }
 /**
  * {@inheritDoc}
  */
 public function getData()
 {
     return (int) parent::getData();
 }
Пример #6
0
 /**
  * {@inheritDoc}
  */
 public function render(array $attributes = array())
 {
     return parent::render($attributes) . ' %';
 }