protected static function GoogleAnalyticsAdminSettingsForm::convertFormValueDataTypes in Google Analytics 8.3
Same name and namespace in other branches
- 8.2 src/Form/GoogleAnalyticsAdminSettingsForm.php \Drupal\google_analytics\Form\GoogleAnalyticsAdminSettingsForm::convertFormValueDataTypes()
- 4.x src/Form/GoogleAnalyticsAdminSettingsForm.php \Drupal\google_analytics\Form\GoogleAnalyticsAdminSettingsForm::convertFormValueDataTypes()
Prepare form data types for Json conversion.
Parameters
array $values: Array of values.
Return value
array Value with casted data type.
1 call to GoogleAnalyticsAdminSettingsForm::convertFormValueDataTypes()
- GoogleAnalyticsAdminSettingsForm::extractParameterValues in src/
Form/ GoogleAnalyticsAdminSettingsForm.php - Extracts the values array from the element.
File
- src/
Form/ GoogleAnalyticsAdminSettingsForm.php, line 1011
Class
- GoogleAnalyticsAdminSettingsForm
- Configure Google_Analytics settings for this site.
Namespace
Drupal\google_analytics\FormCode
protected static function convertFormValueDataTypes(array $values) {
foreach ($values as $name => $value) {
// Convert data types.
$match = mb_strtolower($value);
if ($match == 'true') {
$value = TRUE;
}
elseif ($match == 'false') {
$value = FALSE;
}
// Convert other known fields.
switch ($name) {
case 'sample_rate':
// Float types.
settype($value, 'float');
break;
case 'cookie_expires':
// Integer types.
settype($value, 'integer');
break;
}
$values[$name] = $value;
}
return $values;
}