<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}

/**
 * Set input
 *
 * @author Igor Ratsun
 */
class Rtgc_input extends \Abstract_rtgc_callback
{

    protected $options = [
        'type'      => 'text',
        'maxlength' => '255',
    ];

    public function __construct($opt = [])
    {
        if (is_array($opt)) {
            $this->options = array_merge($this->options, $opt);
        }
    }

    public function column($value = '', $data = array())
    {
        return $value;
    }

    public function field($name = '', $value = NULL)
    {
        $data = $this->options;
        $data['name'] = $name;
        $data['value'] = $value;
        get_instance()->load->helper('form');

        return form_input($data);
    }

}
