eZ\Publish\Core\FieldType\FieldType::applyDefaultSettings PHP Method

applyDefaultSettings() public method

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.
public applyDefaultSettings ( mixed &$fieldSettings )
$fieldSettings mixed
    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'];
            }
        }
    }