protected function prepareOptions(array $options = [])
    {
        $helper = $this->formHelper;
        $rulesParser = $helper->createRulesParser($this);
        $rules = $this->getOption('rules');
        $parsedRules = $rules ? $rulesParser->parse($rules) : [];

        $this->options = $helper->mergeOptions($this->options, $options);

        foreach (['attr', 'label_attr', 'wrapper'] as $appendable) {
            // Append values to the 'class' attribute
            if ($this->getOption("{$appendable}.class_append")) {
                // Combine the current class attribute with the appends
                $append = $this->getOption("{$appendable}.class_append");
                $classAttribute = $this->getOption("{$appendable}.class", '').' '.$append;
                $this->setOption("{$appendable}.class", $classAttribute);

                // Then remove the class_append option to prevent it from showing up as an attribute in the HTML
                $this->setOption("{$appendable}.class_append", null);
            }
        }

        if ($this->getOption('attr.multiple') && !$this->getOption('tmp.multipleBracesSet')) {
            $this->name = $this->name.'[]';
            $this->setOption('tmp.multipleBracesSet', true);
        }

        if ($this->parent->haveErrorsEnabled()) {
            $this->addErrorClass();
        }

        if ($this->getOption('required') === true || isset($parsedRules['required'])) {
            $lblClass = $this->getOption('label_attr.class', '');
            $requiredClass = $this->getConfig('defaults.required_class', 'required');

            if (! Str::contains($lblClass, $requiredClass)) {
                $lblClass .= ' '.$requiredClass;
                $this->setOption('label_attr.class', $lblClass);
            }

            if ($this->parent->clientValidationEnabled()) {
                $this->setOption('attr.required', 'required');
            }
        }

        if ($this->parent->clientValidationEnabled() && $parsedRules) {
            $attrs = $this->getOption('attr') + $parsedRules;
            $this->setOption('attr', $attrs);
        }

        $this->setOption('wrapperAttrs', $helper->prepareAttributes($this->getOption('wrapper')));
        $this->setOption('errorAttrs', $helper->prepareAttributes($this->getOption('errors')));

        if ($this->getOption('help_block.text')) {
            $this->setOption(
                'help_block.helpBlockAttrs',
                $helper->prepareAttributes($this->getOption('help_block.attr'))
            );
        }

        return $this->options;
    }
protected function prepareOptions(array $options = [])
    {
        $helper = $this->formHelper;
        $rulesParser = $helper->createRulesParser($this);
        $rules = $this->getOption('rules');
        $parsedRules = $rules ? $rulesParser->parse($rules) : [];

        $this->options = $helper->mergeOptions($this->options, $options);

        foreach (['attr', 'label_attr', 'wrapper'] as $appendable) {
            // Append values to the 'class' attribute
            if ($this->getOption("{$appendable}.class_append")) {
                // Combine the current class attribute with the appends
                $append = $this->getOption("{$appendable}.class_append");
                $classAttribute = $this->getOption("{$appendable}.class", '').' '.$append;
                $this->setOption("{$appendable}.class", $classAttribute);

                // Then remove the class_append option to prevent it from showing up as an attribute in the HTML
                $this->setOption("{$appendable}.class_append", null);
            }
        }

        if ($this->getOption('attr.multiple') && !$this->getOption('tmp.multipleBracesSet')) {
            $this->name = $this->name.'[]';
            $this->setOption('tmp.multipleBracesSet', true);
        }

        if ($this->parent->haveErrorsEnabled()) {
            $this->addErrorClass();
        }

        if ($this->getOption('required') === true || isset($parsedRules['required'])) {
            $lblClass = $this->getOption('label_attr.class', '');
            $requiredClass = $this->getConfig('defaults.required_class', 'required');

            if (! Str::contains($lblClass, $requiredClass)) {
                $lblClass .= ' '.$requiredClass;
                $this->setOption('label_attr.class', $lblClass);
            }

            if ($this->parent->clientValidationEnabled()) {
                $this->setOption('attr.required', 'required');
            }
        }

        if ($this->parent->clientValidationEnabled() && $parsedRules) {
            $attrs = $this->getOption('attr') + $parsedRules;
            $this->setOption('attr', $attrs);
        }

        $this->setOption('wrapperAttrs', $helper->prepareAttributes($this->getOption('wrapper')));
        $this->setOption('errorAttrs', $helper->prepareAttributes($this->getOption('errors')));

        if ($this->getOption('help_block.text')) {
            $this->setOption(
                'help_block.helpBlockAttrs',
                $helper->prepareAttributes($this->getOption('help_block.attr'))
            );
        }

        return $this->options;
    }
protected function prepareOptions ( array $ options = [ ] ) { $ helper = $ this -> formHelper ; $ rulesParser = $ helper -> createRulesParser ( $ this ) ; $ rules = $ this -> getOption ( 'rules' ) ; $ parsedRules = $ rules ? $ rulesParser -> parse ( $ rules ) : [ ] ; $ this -> options = $ helper -> mergeOptions ( $ this -> options , $ options ) ; foreach ( [ 'attr' , 'label_attr' , 'wrapper' ] as $ appendable ) { // Append values to the 'class' attribute if ( $ this -> getOption ( "{$appendable}.class_append" ) ) { // Combine the current class attribute with the appends $ append = $ this -> getOption ( "{$appendable}.class_append" ) ; $ classAttribute = $ this -> getOption ( "{$appendable}.class" , '' ) . ' ' . $ append ; $ this -> setOption ( "{$appendable}.class" , $ classAttribute ) ; // Then remove the class_append option to prevent it from showing up as an attribute in the HTML $ this -> setOption ( "{$appendable}.class_append" , null ) ; } } if ( $ this -> getOption ( 'attr.multiple' ) && ! $ this -> getOption ( 'tmp.multipleBracesSet' ) ) { $ this -> name = $ this -> name . '[]' ; $ this -> setOption ( 'tmp.multipleBracesSet' , true ) ; } if ( $ this -> parent -> haveErrorsEnabled ( ) ) { $ this -> addErrorClass ( ) ; } if ( $ this -> getOption ( 'required' ) === true || isset ( $ parsedRules [ 'required' ] ) ) { $ lblClass = $ this -> getOption ( 'label_attr.class' , '' ) ; $ requiredClass = $ this -> getConfig ( 'defaults.required_class' , 'required' ) ; if ( ! Str :: contains ( $ lblClass , $ requiredClass ) ) { $ lblClass .= ' ' . $ requiredClass ; $ this -> setOption ( 'label_attr.class' , $ lblClass ) ; } if ( $ this -> parent -> clientValidationEnabled ( ) ) { $ this -> setOption ( 'attr.required' , 'required' ) ; } } if ( $ this -> parent -> clientValidationEnabled ( ) && $ parsedRules ) { $ attrs = $ this -> getOption ( 'attr' ) + $ parsedRules ; $ this -> setOption ( 'attr' , $ attrs ) ; } $ this -> setOption ( 'wrapperAttrs' , $ helper -> prepareAttributes ( $ this -> getOption ( 'wrapper' ) ) ) ; $ this -> setOption ( 'errorAttrs' , $ helper -> prepareAttributes ( $ this -> getOption ( 'errors' ) ) ) ; if ( $ this -> getOption ( 'help_block.text' ) ) { $ this -> setOption ( 'help_block.helpBlockAttrs' , $ helper -> prepareAttributes ( $ this -> getOption ( 'help_block.attr' ) ) ) ; } return $ this -> options ; }
Prepare options for rendering.

@param array $options
@return array
Prepare options for rendering .