function validate($value) { // Let op: DingesLabelField::validate(); niet parent::validate() if (($error = DingesLabelField::validate($value)) !== true) { return $error; } if ($this->required && (!$value || $value['error'] == UPLOAD_ERR_NO_FILE)) { return 'ERR_EMPTY'; } if (!$value || $value['tmp_name'] == '') { return true; } if ($value['error'] == UPLOAD_ERR_PARTIAL || $value['error'] == UPLOAD_ERR_NO_TMP_DIR || $value['error'] == UPLOAD_ERR_CANT_WRITE || $value['error'] == UPLOAD_ERR_EXTENSION) { return 'ERR_FILE_TECHNICAL'; } if ($value['error'] == UPLOAD_ERR_INI_SIZE || $value['error'] == UPLOAD_ERR_FORM_SIZE || $this->maxFileSize !== NULL && $value['size'] > $this->maxFileSize) { return 'ERR_FILE_TOO_BIG'; } if ($this->minFileSize !== NULL && $value['size'] < $this->minFileSize) { return 'ERR_FILE_TOO_SMALL'; } if (!is_uploaded_file($value['tmp_name'])) { // Hijack?? return 'ERR_FILE_TECHNICAL'; } return true; }
function fillLabelAttributes() { parent::fillLabelAttributes(); if ($this->required) { if ($this->getLabelAttribute('class')) { $this->setLabelAttribute('class', ' dingesLabelRequired', true); } else { $this->setLabelAttribute('class', 'dingesLabelRequired'); } } }