public function applyDefaultSettings(&$fieldSettings)
    {
        if ($fieldSettings !== null && !is_array($fieldSettings)) {
            throw new InvalidArgumentType('$fieldSettings', 'array|null', $fieldSettings);
        }

        foreach ($this->getSettingsSchema() as $settingName => $settingConfiguration) {
            // Checking that a default entry exists in the settingsSchema but that no value has been provided
            if (!array_key_exists($settingName, (array)$fieldSettings) && array_key_exists('default', $settingConfiguration)) {
                $fieldSettings[$settingName] = $settingConfiguration['default'];
            }
        }
    }
public function applyDefaultSettings(&$fieldSettings)
    {
        if ($fieldSettings !== null && !is_array($fieldSettings)) {
            throw new InvalidArgumentType('$fieldSettings', 'array|null', $fieldSettings);
        }

        foreach ($this->getSettingsSchema() as $settingName => $settingConfiguration) {
            // Checking that a default entry exists in the settingsSchema but that no value has been provided
            if (!array_key_exists($settingName, (array)$fieldSettings) && array_key_exists('default', $settingConfiguration)) {
                $fieldSettings[$settingName] = $settingConfiguration['default'];
            }
        }
    }
public function applyDefaultSettings ( & $ fieldSettings ) { if ( $ fieldSettings !== null && ! is_array ( $ fieldSettings ) ) { throw new InvalidArgumentType ( '$fieldSettings' , 'array|null' , $ fieldSettings ) ; } foreach ( $ this -> getSettingsSchema ( ) as $ settingName => $ settingConfiguration ) { // Checking that a default entry exists in the settingsSchema but that no value has been provided if ( ! array_key_exists ( $ settingName , ( array ) $ fieldSettings ) && array_key_exists ( 'default' , $ settingConfiguration ) ) { $ fieldSettings [ $ settingName ] = $ settingConfiguration [ 'default' ] ; } } }
Applies the default values to the fieldSettings of a FieldDefinitionCreateStruct.

This is a base implementation, expecting best practice field settings format used by
field types in standard eZ publish installation. Overwrite in derived types if needed.

@throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException

@param mixed $fieldSettings
Applies the default values to the fieldSettings of a FieldDefinitionCreateStruct .