/** * Append custom validation fields to the default 'Validation' * section in the editable options view * * @return FieldSet */ public function getFieldValidationOptions() { $fields = new FieldSet(new CheckboxField("Fields[{$this->ID}][Required]", _t('EditableFormField.REQUIRED', 'Is this field Required?'), $this->Required), new TextField("Fields[{$this->ID}][CustomErrorMessage]", _t('EditableFormField.CUSTOMERROR', 'Custom Error Message'), $this->CustomErrorMessage)); if (!$this->canEdit()) { foreach ($fields as $field) { $fields->performReadonlyTransformation(); } } return $fields; }