protected function handleDataAttributes()
    {
        $dataAttributes = [];

        $dataAttributesAssetHandler = $this->getDataAttributesAssetHandler();

        if ($this->formObject->hasForm()) {
            if (false === $this->formObject->hasFormResult()) {
                $form = $this->formObject->getForm();
                $formValidator = $this->getFormValidator($this->getFormObjectName());
                $formResult = $formValidator->validateGhost($form);
            } else {
                $formResult = $this->formObject->getFormResult();
            }

            $dataAttributes += $dataAttributesAssetHandler->getFieldsValuesDataAttributes($formResult);
        }

        if (true === $this->formObject->formWasSubmitted()) {
            $dataAttributes += [DataAttributesAssetHandler::getFieldSubmissionDone() => '1'];
            $dataAttributes += $dataAttributesAssetHandler->getFieldsValidDataAttributes();
            $dataAttributes += $dataAttributesAssetHandler->getFieldsMessagesDataAttributes();
        }

        $this->tag->addAttributes($dataAttributes);
    }
protected function handleDataAttributes()
    {
        $dataAttributes = [];

        $dataAttributesAssetHandler = $this->getDataAttributesAssetHandler();

        if ($this->formObject->hasForm()) {
            if (false === $this->formObject->hasFormResult()) {
                $form = $this->formObject->getForm();
                $formValidator = $this->getFormValidator($this->getFormObjectName());
                $formResult = $formValidator->validateGhost($form);
            } else {
                $formResult = $this->formObject->getFormResult();
            }

            $dataAttributes += $dataAttributesAssetHandler->getFieldsValuesDataAttributes($formResult);
        }

        if (true === $this->formObject->formWasSubmitted()) {
            $dataAttributes += [DataAttributesAssetHandler::getFieldSubmissionDone() => '1'];
            $dataAttributes += $dataAttributesAssetHandler->getFieldsValidDataAttributes();
            $dataAttributes += $dataAttributesAssetHandler->getFieldsMessagesDataAttributes();
        }

        $this->tag->addAttributes($dataAttributes);
    }
protected function handleDataAttributes ( ) { $ dataAttributes = [ ] ; $ dataAttributesAssetHandler = $ this -> getDataAttributesAssetHandler ( ) ; if ( $ this -> formObject -> hasForm ( ) ) { if ( false === $ this -> formObject -> hasFormResult ( ) ) { $ form = $ this -> formObject -> getForm ( ) ; $ formValidator = $ this -> getFormValidator ( $ this -> getFormObjectName ( ) ) ; $ formResult = $ formValidator -> validateGhost ( $ form ) ; } else { $ formResult = $ this -> formObject -> getFormResult ( ) ; } $ dataAttributes += $ dataAttributesAssetHandler -> getFieldsValuesDataAttributes ( $ formResult ) ; } if ( true === $ this -> formObject -> formWasSubmitted ( ) ) { $ dataAttributes += [ DataAttributesAssetHandler :: getFieldSubmissionDone ( ) => '1' ] ; $ dataAttributes += $ dataAttributesAssetHandler -> getFieldsValidDataAttributes ( ) ; $ dataAttributes += $ dataAttributesAssetHandler -> getFieldsMessagesDataAttributes ( ) ; } $ this -> tag -> addAttributes ( $ dataAttributes ) ; }
Adds custom data attributes to the form element, based on the
submitted form values and results.
Adds custom data attributes to the form element based on the submitted form values and results .