LanguageSettings
in package
Survey Updater Service LanguageSettings
Service class for survey language setting updating.
Dependencies are injected to enable mocking.
Table of Contents
Properties
- $inputFields : mixed
- $modelPermission : Permission|null
- $modelSurvey : Survey|null
- $modelSurveyLanguageSetting : SurveyLanguageSetting|null
Methods
- __construct() : mixed
- update() : bool
- Update
- updateLanguageSettings() : void
- Update language specific settings
- getLanguageSettingsData() : array<string|int, mixed>|null
- Parse language settings from input data
- getValue() : mixed
- Get Value
Properties
$inputFields
private
mixed
$inputFields
= ['surveyls_url', 'surveyls_urldescription', 'surveyls_title', 'surveyls_alias', 'surveyls_description', 'surveyls_welcometext', 'surveyls_endtext', 'surveyls_policy_notice', 'surveyls_policy_error', 'surveyls_policy_notice_label', 'surveyls_dateformat', 'surveyls_numberformat']
$modelPermission
private
Permission|null
$modelPermission
$modelSurvey
private
Survey|null
$modelSurvey
$modelSurveyLanguageSetting
private
SurveyLanguageSetting|null
$modelSurveyLanguageSetting
Methods
__construct()
public
__construct(Permission $modelPermission, Survey $modelSurvey, SurveyLanguageSetting $modelSurveyLanguageSetting) : mixed
Parameters
- $modelPermission : Permission
- $modelSurvey : Survey
- $modelSurveyLanguageSetting : SurveyLanguageSetting
update()
Update
public
update(int $surveyId, array<string|int, mixed> $input) : bool
Input is an array of language specific settings keyed by language code. Each element is an array with one or more of the follow keys:
- url
- url_description
- short_title
- alias
- description
- welcome
- end_text
- policy_notice
- policy_error
- policy_notice_label
- date_format
- number_format
Parameters
- $surveyId : int
- $input : array<string|int, mixed>
Tags
Return values
boolupdateLanguageSettings()
Update language specific settings
protected
updateLanguageSettings(Survey $survey, array<string|int, mixed> $input) : void
Parameters
- $survey : Survey
- $input : array<string|int, mixed>
Tags
getLanguageSettingsData()
Parse language settings from input data
private
getLanguageSettingsData(array<string|int, mixed> $input, string $languageCode) : array<string|int, mixed>|null
Parameters
- $input : array<string|int, mixed>
- $languageCode : string
Return values
array<string|int, mixed>|nullgetValue()
Get Value
private
getValue(array<string|int, mixed> $data, string $field[, string|null $default = null ]) : mixed
Parameters
- $data : array<string|int, mixed>
- $field : string
- $default : string|null = null