Skip to content
Snippets Groups Projects
Commit 5032b166 authored by Arti's avatar Arti Committed by Italo Mairo
Browse files

Issue #3368302 by arti_parmar: t() calls should be avoided in classes, use...

Issue #3368302 by arti_parmar:  t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
parent 9ca2966a
Branches
Tags
No related merge requests found
......@@ -211,7 +211,7 @@ abstract class GeocodeFormatterBase extends FormatterBase implements ContainerFa
'#title' => 'Output format',
'#default_value' => $this->getSetting('dumper'),
'#options' => $this->dumperPluginManager->getPluginsAsOptions(),
'#description' => t('Set the output format of the value. Ex, for a geofield, the format must be set to WKT.'),
'#description' => $this->t('Set the output format of the value. Ex, for a geofield, the format must be set to WKT.'),
];
return $element;
......
......@@ -165,7 +165,7 @@ class DefaultField extends PluginBase implements GeocoderFieldPluginInterface, C
*/
public function getSettingsForm(FieldConfigInterface $field, array $form, FormStateInterface &$form_state) {
$geocoder_settings_link = $this->link->generate(t('Edit options in the Geocoder configuration page</span>'), Url::fromRoute('geocoder.settings', [], [
$geocoder_settings_link = $this->link->generate($this->t('Edit options in the Geocoder configuration page</span>'), Url::fromRoute('geocoder.settings', [], [
'query' => [
'destination' => Url::fromRoute('<current>')
->toString(),
......@@ -174,7 +174,7 @@ class DefaultField extends PluginBase implements GeocoderFieldPluginInterface, C
$element = [
'#type' => 'details',
'#title' => t('Geocode'),
'#title' => $this->t('Geocode'),
'#open' => TRUE,
];
......@@ -334,10 +334,10 @@ class DefaultField extends PluginBase implements GeocoderFieldPluginInterface, C
$element['geocode']['delta_handling'] = [
'#type' => 'select',
'#title' => $this->t('Multi-value input handling'),
'#description' => 'If the source field is a multi-value field, this is mapped 1-on-1 by default.
'#description' => $this->t('If the source field is a multi-value field, this is mapped 1-on-1 by default.
That means that if you can add an unlimited amount of text fields, this also results in an
unlimited amount of geocodes. However, if you have one field that contains multiple geocodes
(like a file) you can select single-to-multiple to extract all geocodes from the first field.',
(like a file) you can select single-to-multiple to extract all geocodes from the first field.'),
'#default_value' => $field->getThirdPartySetting('geocoder_field', 'delta_handling', 'default'),
'#options' => [
'default' => $this->t('Match Multiples (default)'),
......@@ -392,7 +392,7 @@ class DefaultField extends PluginBase implements GeocoderFieldPluginInterface, C
$form_values = $form_state->getValues();
if ($form_values['method'] !== 'none' && empty($form_values['providers'])) {
$form_state->setError($form['third_party_settings']['geocoder_field']['providers'], t('The selected Geocode operation needs at least one provider.'));
$form_state->setError($form['third_party_settings']['geocoder_field']['providers'], $this->t('The selected Geocode operation needs at least one provider.'));
}
// On Reverse Geocode the delta_handling should always be 'default'
......
......@@ -170,7 +170,7 @@ abstract class GeoPhpGeocodeFormatter extends FileGeocodeFormatter {
$summary['intro'] = $this->pluginDefinition['description'];
$summary += parent::settingsSummary();
unset($summary['dumper']);
$summary['adapter'] = t('Output format: @format', [
$summary['adapter'] = $this->t('Output format: @format', [
'@format' => !empty($adapter) ? $adapters[$adapter] : $this->t('Not set'),
]);
return $summary;
......
......@@ -153,7 +153,7 @@ class DumperPluginManager extends GeocoderPluginManagerBase {
if (\in_array($field_config->getType(), $this->maxLengthFieldTypes, TRUE) &&
\strlen($dumper_result) > $field_config->getFieldStorageDefinition()->getSetting('max_length')) {
$incompatibility_warning_message = t("The '@field_name' field 'max length' property is not compatible with the chosen '@dumper' dumper.<br>Thus <b>be aware</b> <u>the dumper output result has been truncated to @max_length chars (max length)</u>.<br> You are advised to change the '@field_name' field definition or chose another compatible dumper.", [
$incompatibility_warning_message = $this->t("The '@field_name' field 'max length' property is not compatible with the chosen '@dumper' dumper.<br>Thus <b>be aware</b> <u>the dumper output result has been truncated to @max_length chars (max length)</u>.<br> You are advised to change the '@field_name' field definition or chose another compatible dumper.", [
'@field_name' => $field_config->getLabel(),
'@dumper' => $dumper->getPluginId(),
'@max_length' => $field_config->getFieldStorageDefinition()->getSetting('max_length'),
......
......@@ -135,7 +135,7 @@ class ProviderPluginManager extends GeocoderPluginManagerBase {
* The plugins table list.
*/
public function providersPluginsTableList(array $enabled_provider_ids): array {
$providers_link = $this->link->generate(t('Geocoder providers configuration page'), Url::fromRoute('entity.geocoder_provider.collection', [], [
$providers_link = $this->link->generate($this->t('Geocoder providers configuration page'), Url::fromRoute('entity.geocoder_provider.collection', [], [
'attributes' => ['target' => '_blank'],
]));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment