<?php

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

namespace Application\Admin\Form;

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

    /**
     * {@inheritdoc}
     */
    protected function getFieldValue()
    {
        return format_price(parent::getFieldValue(), false);

        //return number_format(floatval(parent::getFieldValue()), 2, '.', '');
    }
}
