<?php

/**
 * Questo file è parte di Pongho.
 *
 * @author Daniele De Nobili
 * @package Application\Admin
 */

namespace Application\Admin\Form;

/**
 * Campo numero decimale.
 *
 * @deprecated
 */
class FloatField extends TextField
{
    /**
     * {@inheritdoc}
     */
    public function setAttributeModel()
    {
        $this->model->{$this->attribute_name} = isset($_POST[$this->post_name]) ? floatval($_POST[$this->post_name]) : $this->default;
    }

    /**
     * {@inheritdoc}
     */
    protected function getFieldValue()
    {
        return number_format(floatval(parent::getFieldValue()), 2, '.', '');
    }
}
