src/Potter/Utils/Form/Fields/Checkable.php
public function addChoice($_choice, $_value = null)
    {
        if (is_array($_choice)):
            $text  = array_get($_choice, 'label');
            $value = array_get($_choice, 'value');
            $atts  = array_except($_choice, ['label']);
        else:
            $text  = $_choice;
            $value = (is_null($_value)) ? $_choice : $_value;
            $atts  = ['value' => $value];
        endif;

        if (!isset($atts['id'])) $atts['id'] = $this->id . '-' . $this->choices->count();

        $choice                 = new Input($this->type, $this->name, $value, $atts);
        $choice->inputCheckable = true;

        $choice->setAttribute('type', $this->type);

        if ($this->isSelected($value)) $choice->setAttribute('checked', 'checked');

        $choice->addClass($this->type);
        $choice->setLabel($text);
        $choice->setContainer(null);

        $this->choices->push($choice);

        return $this;
    }
public function addChoice($_choice, $_value = null)
    {
        if (is_array($_choice)):
            $text  = array_get($_choice, 'label');
            $value = array_get($_choice, 'value');
            $atts  = array_except($_choice, ['label']);
        else:
            $text  = $_choice;
            $value = (is_null($_value)) ? $_choice : $_value;
            $atts  = ['value' => $value];
        endif;

        if (!isset($atts['id'])) $atts['id'] = $this->id . '-' . $this->choices->count();

        $choice                 = new Input($this->type, $this->name, $value, $atts);
        $choice->inputCheckable = true;

        $choice->setAttribute('type', $this->type);

        if ($this->isSelected($value)) $choice->setAttribute('checked', 'checked');

        $choice->addClass($this->type);
        $choice->setLabel($text);
        $choice->setContainer(null);

        $this->choices->push($choice);

        return $this;
    }
@param string|array $_choice
@param string       $_value

@return $this