public function buildValidationSelect(XMLElement &$wrapper, $selected = null, $name = 'fields[validator]', $type = 'input', array $errors = null)
    {
        include TOOLKIT . '/util.validators.php';

        $rules = ($type == 'upload' ? $upload : $validators);

        $label = Widget::Label(__('Validation Rule'));
        $label->setAttribute('class', 'column');
        $label->appendChild(new XMLElement('i', __('Optional')));
        $label->appendChild(Widget::Input($name, $selected));

        $ul = new XMLElement('ul', null, array('class' => 'tags singular', 'data-interactive' => 'data-interactive'));
        foreach ($rules as $name => $rule) {
            $ul->appendChild(new XMLElement('li', $name, array('class' => $rule)));
        }

        if (isset($errors['validator'])) {
            $div = new XMLElement('div');
            $div->appendChild($label);
            $div->appendChild($ul);

            $wrapper->appendChild(Widget::Error($div, $errors['validator']));
        } else {
            $wrapper->appendChild($label);
            $wrapper->appendChild($ul);
        }
    }
public function buildValidationSelect(XMLElement &$wrapper, $selected = null, $name = 'fields[validator]', $type = 'input', array $errors = null)
    {
        include TOOLKIT . '/util.validators.php';

        $rules = ($type == 'upload' ? $upload : $validators);

        $label = Widget::Label(__('Validation Rule'));
        $label->setAttribute('class', 'column');
        $label->appendChild(new XMLElement('i', __('Optional')));
        $label->appendChild(Widget::Input($name, $selected));

        $ul = new XMLElement('ul', null, array('class' => 'tags singular', 'data-interactive' => 'data-interactive'));
        foreach ($rules as $name => $rule) {
            $ul->appendChild(new XMLElement('li', $name, array('class' => $rule)));
        }

        if (isset($errors['validator'])) {
            $div = new XMLElement('div');
            $div->appendChild($label);
            $div->appendChild($ul);

            $wrapper->appendChild(Widget::Error($div, $errors['validator']));
        } else {
            $wrapper->appendChild($label);
            $wrapper->appendChild($ul);
        }
    }
public function buildValidationSelect ( XMLElement & $ wrapper , $ selected = null , $ name = 'fields[validator]' , $ type = 'input' , array $ errors = null ) { include TOOLKIT . '/util.validators.php' ; $ rules = ( $ type == 'upload' ? $ upload : $ validators ) ; $ label = Widget :: Label ( __ ( 'Validation Rule' ) ) ; $ label -> setAttribute ( 'class' , 'column' ) ; $ label -> appendChild ( new XMLElement ( 'i' , __ ( 'Optional' ) ) ) ; $ label -> appendChild ( Widget :: Input ( $ name , $ selected ) ) ; $ ul = new XMLElement ( 'ul' , null , array ( 'class' => 'tags singular' , 'data-interactive' => 'data-interactive' ) ) ; foreach ( $ rules as $ name => $ rule ) { $ ul -> appendChild ( new XMLElement ( 'li' , $ name , array ( 'class' => $ rule ) ) ) ; } if ( isset ( $ errors [ 'validator' ] ) ) { $ div = new XMLElement ( 'div' ) ; $ div -> appendChild ( $ label ) ; $ div -> appendChild ( $ ul ) ; $ wrapper -> appendChild ( Widget :: Error ( $ div , $ errors [ 'validator' ] ) ) ; } else { $ wrapper -> appendChild ( $ label ) ; $ wrapper -> appendChild ( $ ul ) ; } }
Append a validator selector to a given `XMLElement`. Note that this
function differs from the other two similarly named build functions in
that it takes an `XMLElement` to append the Validator to as a parameter,
and does not return anything.

@param XMLElement $wrapper
the parent element to append the XMLElement of the Validation select to,
passed by reference.
@param string $selected (optional)
the current validator selection if there is one. defaults to null if there
isn't.
@param string $name (optional)
the form element name of this field. this defaults to "fields[validator]".
@param string $type (optional)
the type of input for the validation to apply to. this defaults to 'input'
but also accepts 'upload'.
@param array $errors (optional)
an associative array of errors
@throws InvalidArgumentException
Append a validator selector to a given XMLElement . Note that this function differs from the other two similarly named build functions in that it takes an XMLElement to append the Validator to as a parameter and does not return anything .