src/Contao/View/Contao2BackendView/ActionHandler/MultipleHandler/OverrideAllHandler.php
private function setDefaultValue(
        ModelInterface $model,
        PropertyValueBagInterface $propertyValueBag,
        $propertyName,
        EnvironmentInterface $environment
    ) {
        $propertiesDefinition = $environment->getDataDefinition()->getPropertiesDefinition();

        // If in the intersect model the value available, then set it as default.
        if ($modelValue = $model->getProperty($propertyName)) {
            $propertyValueBag->setPropertyValue($propertyName, $modelValue);

            return;
        }

        if ($propertiesDefinition->hasProperty($propertyName)
            && !$environment->getInputProvider()->hasValue($propertyName)
        ) {
            $propertyValueBag->setPropertyValue(
                $propertyName,
                $propertiesDefinition->getProperty($propertyName)->getDefaultValue()
            );
        }
    }
private function setDefaultValue(
        ModelInterface $model,
        PropertyValueBagInterface $propertyValueBag,
        $propertyName,
        EnvironmentInterface $environment
    ) {
        $propertiesDefinition = $environment->getDataDefinition()->getPropertiesDefinition();

        // If in the intersect model the value available, then set it as default.
        if ($modelValue = $model->getProperty($propertyName)) {
            $propertyValueBag->setPropertyValue($propertyName, $modelValue);

            return;
        }

        if ($propertiesDefinition->hasProperty($propertyName)
            && !$environment->getInputProvider()->hasValue($propertyName)
        ) {
            $propertyValueBag->setPropertyValue(
                $propertyName,
                $propertiesDefinition->getProperty($propertyName)->getDefaultValue()
            );
        }
    }
private function setDefaultValue ( ModelInterface $ model , PropertyValueBagInterface $ propertyValueBag , $ propertyName , EnvironmentInterface $ environment ) { $ propertiesDefinition = $ environment -> getDataDefinition ( ) -> getPropertiesDefinition ( ) ; // If in the intersect model the value available, then set it as default. if ( $ modelValue = $ model -> getProperty ( $ propertyName ) ) { $ propertyValueBag -> setPropertyValue ( $ propertyName , $ modelValue ) ; return ; } if ( $ propertiesDefinition -> hasProperty ( $ propertyName ) && ! $ environment -> getInputProvider ( ) -> hasValue ( $ propertyName ) ) { $ propertyValueBag -> setPropertyValue ( $ propertyName , $ propertiesDefinition -> getProperty ( $ propertyName ) -> getDefaultValue ( ) ) ; } }
Set the default value if no value is set.

@param ModelInterface            $model            The model.
@param PropertyValueBagInterface $propertyValueBag The property value bag.
@param string                    $propertyName     The property name.
@param EnvironmentInterface      $environment      The environment.

@return void
Set the default value if no value is set .