mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
33 lines
1008 B
PHP
33 lines
1008 B
PHP
<?php
|
|
|
|
namespace SilverStripe\UserForms\FormField;
|
|
|
|
use SilverStripe\Forms\OptionsetField;
|
|
use SilverStripe\UserForms\Model\EditableFormField;
|
|
|
|
/**
|
|
* @package userforms
|
|
*/
|
|
class UserFormsOptionSetField extends OptionsetField
|
|
{
|
|
|
|
/**
|
|
* If your project uses a custom UserFormsCheckboxSetField.ss, ensure that it includes
|
|
* `$Top.getValidationAttributesHTML().RAW` so that custom validation messages work
|
|
* For further details see
|
|
* templates/SilverStripe/UserForms/FormField/UserFormsCheckboxSetField.ss
|
|
*
|
|
* Use on a template with .RAW - single and double quoted strings will be safely escaped
|
|
*
|
|
* @return string
|
|
* @see EditableFormField::updateFormField()
|
|
*/
|
|
public function getValidationAttributesHTML()
|
|
{
|
|
$attrs = array_filter(array_keys($this->getAttributes()), function ($attr) {
|
|
return !in_array($attr, ['data-rule-required', 'data-msg-required']);
|
|
});
|
|
return $this->getAttributesHTML(...$attrs);
|
|
}
|
|
}
|