Location: PHPKode > scripts > Nibble forms > Nibble-Forms-master/Nibble/NibbleForms/Field/Radio.php
<?php

namespace Nibble\NibbleForms\Field;

use Nibble\NibbleForms\Useful;

class Radio extends Options
{

    public function returnField($form_name, $name, $value = '')
    {
        $field = '';
        foreach ($this->options as $key => $val) {
            $attributes = $this->getAttributeString($val);
            $field .= sprintf('<input type="radio" name="%6$s[%1$s]" id="%6$s_%3$s" value="%2$s" %4$s/>' .
                    '<label for="%6$s_%3$s">%5$s</label>'
                    , $name, $key, Useful::slugify($name) . '_' . Useful::slugify($key), ((string) $key === (string) $value ? 'checked="checked"' : '') . $attributes['string'], $attributes['val'], $form_name);
        }
        $class = !empty($this->error) ? 'error choice_label' : 'choice_label';

        return array(
            'messages' => !empty($this->custom_error) && !empty($this->error) ? $this->custom_error : $this->error,
            'label' => $this->label == false ? false : sprintf('<label class="%s">%s</p>', $class, $this->label),
            'field' => $field,
            'html' => $this->html
        );
    }

}
Return current item: Nibble forms