/** * {@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')))); }
/** * {@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; }
/** * {@inheritDoc} */ public function render(array $attributes = array()) { return parent::render(array_merge(array('type' => 'text'), $attributes)); }
/** * {@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); }
/** * {@inheritDoc} */ public function render(array $attributes = array()) { return parent::render(array_merge(array('type' => 'text', 'maxlength' => $this->getOption('max_length')), $attributes)); }
/** * {@inheritDoc} */ public function getAttributes(array $attributes = array()) { return array_merge(parent::getAttributes(), array('type' => 'text')); }