public function applyBehaviourOnFormInstance(FormObject $formObject)
    {
        if ($formObject->hasForm()) {
            $formInstance = $formObject->getForm();

            foreach ($formObject->getConfiguration()->getFields() as $fieldName => $field) {
                if (ObjectAccess::isPropertyGettable($formInstance, $fieldName)
                    && ObjectAccess::isPropertySettable($formInstance, $fieldName)
                ) {
                    $propertyValue = ObjectAccess::getProperty($formInstance, $fieldName);

                    foreach ($field->getBehaviours() as $behaviour) {
                        /** @var AbstractBehaviour $behaviourInstance */
                        $behaviourInstance = GeneralUtility::makeInstance($behaviour->getClassName());

                        // Applying the behaviour on the field's value.
                        $propertyValue = $behaviourInstance->applyBehaviour($propertyValue);
                    }

                    ObjectAccess::setProperty($formInstance, $fieldName, $propertyValue);
                }
            }
        }
    }
public function applyBehaviourOnFormInstance(FormObject $formObject)
    {
        if ($formObject->hasForm()) {
            $formInstance = $formObject->getForm();

            foreach ($formObject->getConfiguration()->getFields() as $fieldName => $field) {
                if (ObjectAccess::isPropertyGettable($formInstance, $fieldName)
                    && ObjectAccess::isPropertySettable($formInstance, $fieldName)
                ) {
                    $propertyValue = ObjectAccess::getProperty($formInstance, $fieldName);

                    foreach ($field->getBehaviours() as $behaviour) {
                        /** @var AbstractBehaviour $behaviourInstance */
                        $behaviourInstance = GeneralUtility::makeInstance($behaviour->getClassName());

                        // Applying the behaviour on the field's value.
                        $propertyValue = $behaviourInstance->applyBehaviour($propertyValue);
                    }

                    ObjectAccess::setProperty($formInstance, $fieldName, $propertyValue);
                }
            }
        }
    }
public function applyBehaviourOnFormInstance ( FormObject $ formObject ) { if ( $ formObject -> hasForm ( ) ) { $ formInstance = $ formObject -> getForm ( ) ; foreach ( $ formObject -> getConfiguration ( ) -> getFields ( ) as $ fieldName => $ field ) { if ( ObjectAccess :: isPropertyGettable ( $ formInstance , $ fieldName ) && ObjectAccess :: isPropertySettable ( $ formInstance , $ fieldName ) ) { $ propertyValue = ObjectAccess :: getProperty ( $ formInstance , $ fieldName ) ; foreach ( $ field -> getBehaviours ( ) as $ behaviour ) { /** @var AbstractBehaviour $behaviourInstance */ $ behaviourInstance = GeneralUtility :: makeInstance ( $ behaviour -> getClassName ( ) ) ; // Applying the behaviour on the field's value. $ propertyValue = $ behaviourInstance -> applyBehaviour ( $ propertyValue ) ; } ObjectAccess :: setProperty ( $ formInstance , $ fieldName , $ propertyValue ) ; } } } }
This is the same function as `applyBehaviourOnPropertiesArray`, but works
with an actual form object instance.

@param FormObject $formObject
This is the same function as applyBehaviourOnPropertiesArray but works with an actual form object instance .