protected function GoogleAnalyticsAdminSettingsForm::getNameValueString in Google Analytics 4.x
Same name and namespace in other branches
- 8.3 src/Form/GoogleAnalyticsAdminSettingsForm.php \Drupal\google_analytics\Form\GoogleAnalyticsAdminSettingsForm::getNameValueString()
- 8.2 src/Form/GoogleAnalyticsAdminSettingsForm.php \Drupal\google_analytics\Form\GoogleAnalyticsAdminSettingsForm::getNameValueString()
Generates a string representation of an array.
This string format is suitable for edition in a textarea.
Parameters
array $values: An array of values, where array keys are values and array values are labels.
Return value
string The string representation of the $values array:
- Values are separated by a carriage return.
- Each value is in the format "name|value" or "value".
1 call to GoogleAnalyticsAdminSettingsForm::getNameValueString()
- GoogleAnalyticsAdminSettingsForm::buildForm in src/
Form/ GoogleAnalyticsAdminSettingsForm.php - Form constructor.
File
- src/
Form/ GoogleAnalyticsAdminSettingsForm.php, line 1089
Class
- GoogleAnalyticsAdminSettingsForm
- Configure Google_Analytics settings for this site.
Namespace
Drupal\google_analytics\FormCode
protected function getNameValueString(array $values = []) {
$lines = [];
foreach ($values as $name => $value) {
// Convert data types.
if (is_bool($value)) {
$value = $value ? 'true' : 'false';
}
$lines[] = "{$name}|{$value}";
}
return implode("\n", $lines);
}