src/Potter/Utils/Form/Widget.php
protected function makeField($id, $options)
    {
        $options = wp_parse_args(
            $options, array(
                'label' => $id,
                'type'  => 'text',
                'id'    => $id,
                'name'  => $id,
                'value' => null,
                'class' => 'widefat'
            )
        );

        $options['name'] = $this->widget->get_field_name($options['name']);
        $options['id']   = $this->widget->get_field_id($options['id']);

        $type = $options['type'];

        $value = $this->values->get($id, $options['value']);

        if (in_array($type, self::$fieldsInput)):
            $field = new Fields\Input($type, $options['name'], $value, $options);
        elseif (in_array($type, self::$fieldsTextarea)):
            $field = new Fields\Textarea($type, $options['name'], $value, $options);
        elseif (in_array($type, self::$fieldsSelect)):
            $field = new Fields\Select($type, $options['name'], $value, $options);
        elseif (in_array($type, self::$fieldsCheckbox)):
            $field = new Fields\Checkable($type, $options['name'], $value, $options);
        elseif (in_array($type, self::$fieldsRadio)):
            $field = new Fields\Radio($type, $options['name'], $value, $options);
        else:
            $field = new Fields\Input($type, $options['name'], $value, $options);
        endif;

        return $field;
    }
protected function makeField($id, $options)
    {
        $options = wp_parse_args(
            $options, array(
                'label' => $id,
                'type'  => 'text',
                'id'    => $id,
                'name'  => $id,
                'value' => null,
                'class' => 'widefat'
            )
        );

        $options['name'] = $this->widget->get_field_name($options['name']);
        $options['id']   = $this->widget->get_field_id($options['id']);

        $type = $options['type'];

        $value = $this->values->get($id, $options['value']);

        if (in_array($type, self::$fieldsInput)):
            $field = new Fields\Input($type, $options['name'], $value, $options);
        elseif (in_array($type, self::$fieldsTextarea)):
            $field = new Fields\Textarea($type, $options['name'], $value, $options);
        elseif (in_array($type, self::$fieldsSelect)):
            $field = new Fields\Select($type, $options['name'], $value, $options);
        elseif (in_array($type, self::$fieldsCheckbox)):
            $field = new Fields\Checkable($type, $options['name'], $value, $options);
        elseif (in_array($type, self::$fieldsRadio)):
            $field = new Fields\Radio($type, $options['name'], $value, $options);
        else:
            $field = new Fields\Input($type, $options['name'], $value, $options);
        endif;

        return $field;
    }
@param $id
@param $options

@return \HtmlObject\Traits\Tag