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);
    }