<commit_before><?php
class Vps_Form_Field_Checkbox extends Vps_Form_Field_SimpleAbstract
{
    public function __construct($field_name = null, $field_label = null)
    {
        parent::__construct($field_name, $field_label);
        $this->setXtype('checkbox');
    }

    protected function _getTrlProperties()
    {
        $ret = parent::_getTrlProperties();
        $ret[] = 'boxLabel';
        return $ret;
    }

    protected function _validateNotAllowBlank($data, $name)
    {
        $ret = array();
        if (!$data) {
            $msg = '';
            if (trim($name)) {
                $msg .= $name.': ';
            }
            $msg .= trlVps("Please mark the checkbox");
            $ret[] = $msg;
        }
        return $ret;
    }

    public function getTemplateVars($values, $fieldNamePostfix = '')
    {
        $name = $this->getFieldName();
        $value = isset($values[$name]) ? $values[$name] : $this->getDefaultValue();

        $ret = parent::getTemplateVars($values);
        //todo: escapen
        $ret['id'] = str_replace(array('[', ']'), array('_', '_'), $name.$fieldNamePostfix);
        $ret['html'] = "<input type=\"checkbox\" id=\"$ret[id]\" name=\"$name$fieldNamePostfix\" ";
        if ($value) $ret['html'] .= 'checked="checked" ';
        $ret['html'] .= "/>";<commit_msg>- checkbox hat nun ein setErrorText ... wenn dieser wert NICHT gesetzt ist, wird der default error text ausgegeben<commit_after><?php
class Vps_Form_Field_Checkbox extends Vps_Form_Field_SimpleAbstract
{
    public function __construct($field_name = null, $field_label = null)
    {
        parent::__construct($field_name, $field_label);
        $this->setXtype('checkbox');
        $this->setErrorText(trlVpsStatic("Please mark the checkbox"));
    }

    protected function _getTrlProperties()
    {
        $ret = parent::_getTrlProperties();
        $ret[] = 'boxLabel';
        $ret[] = 'errorText';
        return $ret;
    }

    protected function _validateNotAllowBlank($data, $name)
    {
        $ret = array();
        if (!$data) {
            $msg = '';
            if (trim($name)) {
                $msg .= $name.': ';
            }
            $msg .= $this->getErrorText();
            $ret[] = $msg;
        }
        return $ret;
    }

    public function getTemplateVars($values, $fieldNamePostfix = '')
    {
        $name = $this->getFieldName();
        $value = isset($values[$name]) ? $values[$name] : $this->getDefaultValue();

        $ret = parent::getTemplateVars($values);
        //todo: escapen
        $ret['id'] = str_replace(array('[', ']'), array('_', '_'), $name.$fieldNamePostfix);
        $ret['html'] = "<input type=\"checkbox\" id=\"$ret[id]\" name=\"$name$fieldNamePostfix\" ";
        if ($value) $ret['html'] .= 'checked="checked" ';
        $ret['html'] .= "/>";
{'fraction_non_alphanumeric': 0.17908866125044154, 'fraction_numerical': 0.0, 'mean_word_length': 2.4410692588092346, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4197813', 'n_tokens_mistral': 868, 'n_tokens_neox': 868, 'n_words': 166}