diff --git a/drush/example_layout/example_layout.inc b/drush/example_layout/example_layout.inc index 54ed23a..f91a94c 100644 --- a/drush/example_layout/example_layout.inc +++ b/drush/example_layout/example_layout.inc @@ -7,10 +7,10 @@ function ds_example_layout() { return array( - 'label' => t('Example layout'), + 'label' => $this->t('Example layout'), 'regions' => array( - 'left' => t('Left'), - 'right' => t('Right'), + 'left' => $this->t('Left'), + 'right' => $this->t('Right'), ), // Uncomment if you want to include a CSS file for this layout (example_layout.css). // 'css' => TRUE, diff --git a/ds.api.php b/ds.api.php index d24d57b..6afc95b 100644 --- a/ds.api.php +++ b/ds.api.php @@ -22,7 +22,7 @@ * @see \Drupal\views\Plugin\DsPluginManager */ function hook_ds_fields_info_alter(&$plugins) { - $plugins['node_title']['title'] = t('My title'); + $plugins['node_title']['title'] = $this->t('My title'); } /** @@ -37,7 +37,7 @@ function hook_ds_fields_info_alter(&$plugins) { * @see \Drupal\views\Plugin\DsFieldTemplatePluginManager */ function hook_ds_field_templates_info_alter(&$plugins) { - $plugins['expert']['title'] = t('My template'); + $plugins['expert']['title'] = $this->t('My template'); } /** @@ -103,7 +103,7 @@ function hook_ds_layout_region_alter($context, &$region_info) { $region_info['region_options']['my_region'] = 'New region'; $region_info['table_regions']['my_region'] = array( 'title' => \Drupal\Component\Utility\Html::escape('New region'), - 'message' => t('No fields are displayed in this region'), + 'message' => $this->t('No fields are displayed in this region'), ); } @@ -117,7 +117,7 @@ function hook_ds_layout_region_alter($context, &$region_info) { * A collection of field label options. */ function hook_ds_label_options_alter(&$field_label_options) { - $field_label_options['label_after'] = t('Label after field'); + $field_label_options['label_after'] = $this->t('Label after field'); } /** diff --git a/ds.module b/ds.module index 1c1c6b9..a071864 100644 --- a/ds.module +++ b/ds.module @@ -29,11 +29,11 @@ function ds_help($route_name, RouteMatchInterface $route_match){ switch ($route_name) { case 'help.page.ds': $output = ''; - $output .= '

' . t('About') . '

'; - $output .= '
' . t('The Display Suite module allows you to take full control over how your content is displayed using a drag and drop interface. Arrange your nodes, views, comments, user data etc. the way you want without having to work your way through dozens of template files.'); - $output .= '
' . t('It allows you to apply theme templates to content type displays. It comes with predefined layouts such as "two columns", "three columns stacked", "three columns fluid" et cetera, but also lets you define your own.'); - $output .= '
' . t('Display Suite allows you to create fields from tokens or blocks. This gives you full control over the way content is displayed without having to maintain dozens of twig files.'); - $output .= '
' . t('More documentation about Display Suite in Drupal 8 can be found in Drupal\'s Community Documentation .'); + $output .= '

' . $this->t('About') . '

'; + $output .= '
' . $this->t('The Display Suite module allows you to take full control over how your content is displayed using a drag and drop interface. Arrange your nodes, views, comments, user data etc. the way you want without having to work your way through dozens of template files.'); + $output .= '
' . $this->t('It allows you to apply theme templates to content type displays. It comes with predefined layouts such as "two columns", "three columns stacked", "three columns fluid" et cetera, but also lets you define your own.'); + $output .= '
' . $this->t('Display Suite allows you to create fields from tokens or blocks. This gives you full control over the way content is displayed without having to maintain dozens of twig files.'); + $output .= '
' . $this->t('More documentation about Display Suite in Drupal 8 can be found in Drupal\'s Community Documentation .'); return $output; } } @@ -515,7 +515,7 @@ function ds_contextual_links_view_alter(&$element, $items) { // When there is no bundle defined, return. if (!empty($bundle)) { $element['#links']['manage-display'] = array( - 'title' => t('Manage display'), + 'title' => $this->t('Manage display'), 'url' => $url, ); } @@ -742,7 +742,7 @@ function ds_field_template_settings_form(array &$form, FormStateInterface &$form ); $form['ft']['id'] = array( - '#title' => t('Choose a Field Template'), + '#title' => $this->t('Choose a Field Template'), '#type' => 'select', '#options' => $functions, '#default_value' => $field_function, @@ -797,9 +797,9 @@ function ds_field_formatter_third_party_settings_form(FormatterInterface $plugin $element['ds_limit'] = array( '#type' => 'textfield', - '#title' => t('UI limit'), + '#title' => $this->t('UI limit'), '#size' => 2, - '#description' => t("Enter a number to limit the number of items or 'delta' to print a specific delta (usually configured in views or found in entity->ds_delta). Leave empty to display them all. Note that depending on the formatter settings, this option might not always work."), + '#description' => $this->t("Enter a number to limit the number of items or 'delta' to print a specific delta (usually configured in views or found in entity->ds_delta). Leave empty to display them all. Note that depending on the formatter settings, this option might not always work."), '#default_value' => !empty($settings[$name]['ds_limit']) ? $settings[$name]['ds_limit'] : '', ); } @@ -920,7 +920,7 @@ function template_preprocess_field__ds_field_expert(&$variables) { function ds_ds_field_operations_alter(&$operations, $field) { if ($field['type'] == 'block') { $operations['config'] = array( - 'title' => t('Configure block'), + 'title' => $this->t('Configure block'), 'url' => new Url('ds.manage_block_field_config', array('field_key' => $field['id'])), ); } diff --git a/includes/field_ui.inc b/includes/field_ui.inc index f4b86a1..5085229 100644 --- a/includes/field_ui.inc +++ b/includes/field_ui.inc @@ -177,7 +177,7 @@ function ds_field_ui_regions($form, FormStateInterface $form_state) { $region_options[$region_key] = $region_info['label']; $table['#regions'][$region_key] = array( 'title' => $region_info['label'], - 'message' => t('No fields are displayed in this region'), + 'message' => $this->t('No fields are displayed in this region'), ); } @@ -193,10 +193,10 @@ function ds_field_ui_regions($form, FormStateInterface $form_state) { ); \Drupal::moduleHandler()->alter('ds_layout_region', $context, $region_info); - $region_options['hidden'] = t('Disabled'); + $region_options['hidden'] = $this->t('Disabled'); $table['#regions']['hidden'] = array( - 'title' => t('Disabled'), - 'message' => t('No fields are hidden.'), + 'title' => $this->t('Disabled'), + 'message' => $this->t('No fields are hidden.'), ); $region = array( @@ -224,7 +224,7 @@ function ds_field_ui_regions($form, FormStateInterface $form_state) { if ($form_state->has('plugin_settings')) { $plugin_settings = $form_state->get('plugin_settings'); if (isset($plugin_settings[$name]['ft']['settings']) && !empty($plugin_settings[$name]['ft']['settings']['lb'])) { - $row['human_name']['#plain_text'] = $plugin_settings[$name]['ft']['settings']['lb'] . ' ' . t('(Original: @orig)', array('@orig' => $row['human_name']['#plain_text'])); + $row['human_name']['#plain_text'] = $plugin_settings[$name]['ft']['settings']['lb'] . ' ' . $this->t('(Original: @orig)', array('@orig' => $row['human_name']['#plain_text'])); } } } @@ -570,7 +570,7 @@ function ds_field_ui_layout_clone($form, FormStateInterface $form_state) { $clone_display->save(); // Show message. - drupal_set_message(t('The layout has been cloned.')); + drupal_set_message($this->t('The layout has been cloned.')); } /** @@ -674,7 +674,7 @@ function _ds_field_ui_table_layouts($entity_type, $bundle, $view_mode, &$form, F $layout_options = array('' => t('- None -')); $optgroup = ''; foreach ($ds_layouts as $key => $layout_definition) { - $optgroup = t('Other'); + $optgroup = $this->t('Other'); // Create new layout option group. if (!empty($layout_definition['category'])) { @@ -698,7 +698,7 @@ function _ds_field_ui_table_layouts($entity_type, $bundle, $view_mode, &$form, F // Add layouts form. $form['ds_layouts'] = array( '#type' => 'details', - '#title' => t('Layout for @bundle in @view_mode', array( + '#title' => $this->t('Layout for @bundle in @view_mode', array( '@bundle' => str_replace('_', ' ', $bundle), '@view_mode' => str_replace('_', ' ', $view_mode), )), @@ -763,7 +763,7 @@ function _ds_field_ui_table_layouts($entity_type, $bundle, $view_mode, &$form, F $form['layout_configuration'] = array_merge($layout_configuration_form, [ '#group' => 'additional_settings', '#type' => 'details', - '#title' => t('Layout settings'), + '#title' => $this->t('Layout settings'), '#tree' => TRUE, ]); } @@ -788,19 +788,19 @@ function _ds_field_ui_table_layouts($entity_type, $bundle, $view_mode, &$form, F $form['ds_clone'] = array( '#type' => 'details', '#group' => 'additional_settings', - '#title' => t('Clone layout'), + '#title' => $this->t('Clone layout'), '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['ds_clone']['clone'] = array( - '#title' => t('Select an existing layout to clone.'), + '#title' => $this->t('Select an existing layout to clone.'), '#type' => 'select', '#options' => $options, '#weight' => 20, ); $form['ds_clone']['clone_submit'] = array( '#type' => 'submit', - '#value' => t('Clone layout'), + '#value' => $this->t('Clone layout'), '#submit' => array('ds_field_ui_layout_clone'), '#weight' => 21, ); @@ -838,7 +838,7 @@ function _ds_field_ui_table_layouts_preview(&$form, FormStateInterface $form_sta $form['ds_layouts']['layout'] = array( '#type' => 'select', - '#title' => t('Select a layout'), + '#title' => $this->t('Select a layout'), '#options' => $layout['layout_options'], '#default_value' => isset($layout['layout']) ? $layout['layout'] : '', '#weight' => -1, @@ -849,7 +849,7 @@ function _ds_field_ui_table_layouts_preview(&$form, FormStateInterface $form_sta ); if (!isset($layout['layout'])) { - $form['ds_layouts']['layout']['#description'] = t("A layout must be selected to enable Display Suite functionality."); + $form['ds_layouts']['layout']['#description'] = $this->t("A layout must be selected to enable Display Suite functionality."); } $form['ds_layouts']['preview'] = array( @@ -866,7 +866,7 @@ function _ds_field_ui_table_layouts_preview(&$form, FormStateInterface $form_sta if (!empty($layout_string)) { $chosen_layout = $ds_layouts[$layout_string]; $selected = '' . $chosen_layout['label'] . ''; - $selected .= '
' . t('The default template can be found in %path', array('%path' => $chosen_layout['template_path'])); + $selected .= '
' . $this->t('The default template can be found in %path', array('%path' => $chosen_layout['template_path'])); $suggestions_array = array(); $suggestions_array[0] = $layout_string . '--' . $display->getTargetEntityTypeId(); $suggestions_array[2] = $layout_string . '--' . $display->getTargetBundle() . '-' . $display->getTargetBundle(); @@ -886,7 +886,7 @@ function _ds_field_ui_table_layouts_preview(&$form, FormStateInterface $form_sta if ($form_state->hasValue('layout') || (!empty($layout) && isset($layout['regions']))) { $fallback_image = drupal_get_path('module', 'ds') . '/images/preview.png'; - $current_layout = $form_state->hasValue('layout') && (!isset($layout->layout) || $form_state->getValue('layout') != $layout->layout) ? t('Current layout (after save)') : t('Current layout'); + $current_layout = $form_state->hasValue('layout') && (!isset($layout->layout) || $form_state->getValue('layout') != $layout->layout) ? $this->t('Current layout (after save)') : $this->t('Current layout'); $image = (isset($chosen_layout['icon']) && !empty($chosen_layout['icon'])) ? $chosen_layout['icon'] : $fallback_image; $form['ds_layouts']['preview']['title'] = array( @@ -902,7 +902,7 @@ function _ds_field_ui_table_layouts_preview(&$form, FormStateInterface $form_sta ), ); $form['ds_layouts']['preview']['info']['suggestions'] = array( - '#markup' => '

' . $selected . '

' . t('Template suggestions') . ':' . '

', + '#markup' => '

' . $selected . '

' . $this->t('Template suggestions') . ':' . '

', ); $form['ds_layouts']['preview']['info']['suggestions_list'] = array( '#theme' => 'item_list', @@ -921,7 +921,7 @@ function _ds_field_ui_table_layouts_preview(&$form, FormStateInterface $form_sta $form['ds_layouts']['preview']['info']['settings']['disable_css'] = array( '#type' => 'checkbox', - '#title' => t('Disable layout CSS styles'), + '#title' => $this->t('Disable layout CSS styles'), '#default_value' => $disable_css, ); @@ -938,11 +938,11 @@ function _ds_field_ui_table_layouts_preview(&$form, FormStateInterface $form_sta // Default classes. $form['ds_layouts']['preview']['info']['settings']['entity_classes'] = array( '#type' => 'select', - '#title' => t('Entity classes'), + '#title' => $this->t('Entity classes'), '#options' => array( - 'all_classes' => t('Entity, bundle and view mode'), - 'no_classes' => t('No classes'), - 'old_view_mode' => t('View mode (deprecated)'), + 'all_classes' => $this->t('Entity, bundle and view mode'), + 'no_classes' => $this->t('No classes'), + 'old_view_mode' => $this->t('View mode (deprecated)'), ), '#default_value' => $entity_classes, ); @@ -1053,9 +1053,9 @@ function _ds_field_ui_fields($entity_type, $bundle, $view_mode, &$form, FormStat $form['#ds_fields'] = array(); $field_label_options = array( - 'above' => t('Above'), - 'inline' => t('Inline'), - 'hidden' => t('- Hidden -'), + 'above' => $this->t('Above'), + 'inline' => $this->t('Inline'), + 'hidden' => $this->t('- Hidden -'), ); \Drupal::moduleHandler()->alter('ds_label_options', $field_label_options); @@ -1070,7 +1070,7 @@ function _ds_field_ui_fields($entity_type, $bundle, $view_mode, &$form, FormStat foreach ($field_group_params->groups as $name => $group) { $parent_options[$name] = $group->label; } - $parent_options['_add_new_group'] = t('Add new group'); + $parent_options['_add_new_group'] = $this->t('Add new group'); } foreach ($fields as $key => $field) { @@ -1134,7 +1134,7 @@ function _ds_field_ui_fields($entity_type, $bundle, $view_mode, &$form, FormStat // Save fetched plugin settings. $form_state->set('plugin_settings', $form_state_plugin_settings); - $hidden = array('hidden' => t('- Hidden -')); + $hidden = array('hidden' => $this->t('- Hidden -')); // Get the formatters from the field instance. $formatters = $plugin_instance->formatters(); @@ -1145,7 +1145,7 @@ function _ds_field_ui_fields($entity_type, $bundle, $view_mode, &$form, FormStat $formatters = $hidden + $formatters; } else { - $formatters = $hidden + array('default' => t('Default')); + $formatters = $hidden + array('default' => $this->t('Default')); } $table[$key] = array( @@ -1301,13 +1301,13 @@ function ds_field_row_form_format_construct(&$table, $key, $settings_form, FormS 'save_settings' => $base_button + array( '#type' => 'submit', '#name' => $key . '_plugin_settings_update', - '#value' => t('Update'), + '#value' => $this->t('Update'), '#op' => 'update', ), 'cancel_settings' => $base_button + array( '#type' => 'submit', '#name' => $key . '_plugin_settings_cancel', - '#value' => t('Cancel'), + '#value' => $this->t('Cancel'), '#op' => 'cancel', // Do not check errors for the 'Cancel' button. '#limit_validation_errors' => array(), @@ -1339,7 +1339,7 @@ function ds_field_row_form_format_summary_construct(&$table, $key, FormStateInte '#type' => 'image_button', '#name' => $key . '_plugin_settings_edit', '#src' => 'core/misc/icons/787878/cog.svg', - '#attributes' => array('class' => array('field-plugin-settings-edit'), 'alt' => t('Edit')), + '#attributes' => array('class' => array('field-plugin-settings-edit'), 'alt' => $this->t('Edit')), '#op' => 'edit', // Do not check errors for the 'Edit' button, but make sure we get // the value of the 'plugin type' select. diff --git a/modules/ds_extras/ds_extras.module b/modules/ds_extras/ds_extras.module index 1cde876..ec30696 100644 --- a/modules/ds_extras/ds_extras.module +++ b/modules/ds_extras/ds_extras.module @@ -18,7 +18,7 @@ use Drupal\Core\Url; function ds_extras_layout_alter(&$definitions) { if (\Drupal::config('ds_extras.settings')->get('hidden_region')) { foreach ($definitions as $key => $layout) { - $definitions[$key]['regions']['ds_hidden']['label'] = t('Hidden'); + $definitions[$key]['regions']['ds_hidden']['label'] = $this->t('Hidden'); } } } @@ -70,7 +70,7 @@ function ds_extras_form_entity_view_display_edit_form_alter(&$form, FormStateInt if (!empty($region_blocks)) { foreach ($region_blocks as $key => $block) { if ($block['info'] == "{$entity_type}_{$bundle}_{$view_mode}") { - $region_blocks_options[$key] = t('Remove') . ' ' . $block['title']; + $region_blocks_options[$key] = $this->t('Remove') . ' ' . $block['title']; } } } @@ -78,26 +78,26 @@ function ds_extras_form_entity_view_display_edit_form_alter(&$form, FormStateInt $form['region_to_block'] = array( '#type' => 'details', '#group' => 'additional_settings', - '#title' => t('Block regions (deprecated)'), - '#description' => t('Create additional regions in this layout which will be exposed as blocks.') + '#title' => $this->t('Block regions (deprecated)'), + '#description' => $this->t('Create additional regions in this layout which will be exposed as blocks.') ); $url = Url::fromUri('https://www.drupal.org/node/2754967'); $link = Drupal::l(t('handbook page'), $url); $form['region_to_block']['deprecated'] = array( - '#markup' => '' . t('This functionality is not compatible with some caching modules. Read the @handbook for a better alternative.', array('@handbook' => $link)) . '' + '#markup' => '' . $this->t('This functionality is not compatible with some caching modules. Read the @handbook for a better alternative.', array('@handbook' => $link)) . '' ); $form['region_to_block']['new_block_region'] = array( '#type' => 'textfield', - '#title' => t('Region name'), - '#description' => t('Enter a name to create a new region.'), + '#title' => $this->t('Region name'), + '#description' => $this->t('Enter a name to create a new region.'), ); $form['region_to_block']['new_block_region_key'] = array( - '#title' => t('Machine name'), + '#title' => $this->t('Machine name'), '#type' => 'machine_name', '#default_value' => '', '#maxlength' => 32, '#required' => FALSE, - '#description' => t('The machine-readable name of this block region. This name must contain only lowercase letters and underscores. This name must be unique.'), + '#description' => $this->t('The machine-readable name of this block region. This name must contain only lowercase letters and underscores. This name must be unique.'), '#disabled' => FALSE, '#machine_name' => array( 'exists' => 'ds_extras_region_to_block_unique', @@ -108,9 +108,9 @@ function ds_extras_form_entity_view_display_edit_form_alter(&$form, FormStateInt if (!empty($region_blocks_options)) { $form['region_to_block']['remove_block_region'] = array( '#type' => 'checkboxes', - '#title' => t('Existing block regions'), + '#title' => $this->t('Existing block regions'), '#options' => $region_blocks_options, - '#description' => t('Check the regions you want to remove.'), + '#description' => $this->t('Check the regions you want to remove.'), ); } @@ -204,7 +204,7 @@ function ds_extras_form_ds_admin_form_alter(&$form, FormStateInterface $form_sta $form['fs2'] = array( '#type' => 'details', - '#title' => t('Extra fields'), + '#title' => $this->t('Extra fields'), '#group' => 'additional_settings', '#weight' => 2, '#tree' => TRUE, @@ -212,14 +212,14 @@ function ds_extras_form_ds_admin_form_alter(&$form, FormStateInterface $form_sta $form['fs2']['fields_extra'] = array( '#type' => 'checkbox', - '#title' => t('Enable extra fields'), - '#description' => t('Make fields from other modules available on the "Manage display" screens.'), + '#title' => $this->t('Enable extra fields'), + '#description' => $this->t('Make fields from other modules available on the "Manage display" screens.'), '#default_value' => $config->get('fields_extra'), ); $form['fs2']['fields_extra_list'] = array( '#type' => 'textarea', - '#description' => t('Enter fields line by line, where each line is a combination of entity type, bundle and field name. E.g. node|article|tweetbutton. It might be possible that the actual content of the field depends on configuration of that field/module.'), + '#description' => $this->t('Enter fields line by line, where each line is a combination of entity type, bundle and field name. E.g. node|article|tweetbutton. It might be possible that the actual content of the field depends on configuration of that field/module.'), '#default_value' => implode("\n", $config->get('fields_extra_list')), '#states' => array( 'visible' => array( @@ -230,8 +230,8 @@ function ds_extras_form_ds_admin_form_alter(&$form, FormStateInterface $form_sta $form['fs3']['field_permissions'] = array( '#type' => 'checkbox', - '#title' => t('Field permissions'), - '#description' => t('Enables view permissions on all Display Suite fields.'), + '#title' => $this->t('Field permissions'), + '#description' => $this->t('Enables view permissions on all Display Suite fields.'), '#default_value' => $config->get('field_permissions'), ); @@ -240,30 +240,30 @@ function ds_extras_form_ds_admin_form_alter(&$form, FormStateInterface $form_sta $link = Drupal::l(t('handbook page'), $url); $form['fs3']['region_to_block'] = array( '#type' => 'checkbox', - '#title' => t('Region to block (deprecated)'), - '#description' => t('Create additional regions exposed as block. Note: this will not work on the default view mode.') . '
' . '' . t('This functionality is not compatible with some caching modules. Read the @handbook for a better alternative.', array('@handbook' => $link)) . '', + '#title' => $this->t('Region to block (deprecated)'), + '#description' => $this->t('Create additional regions exposed as block. Note: this will not work on the default view mode.') . '
' . '' . $this->t('This functionality is not compatible with some caching modules. Read the @handbook for a better alternative.', array('@handbook' => $link)) . '', '#default_value' => $config->get('region_to_block'), ); } $form['fs3']['switch_field'] = array( '#type' => 'checkbox', - '#title' => t('View mode switcher'), - '#description' => t('Adds a field with links to switch view modes inline with Ajax. Only works for nodes at this time. It does not work in combination with the reset layout.'), + '#title' => $this->t('View mode switcher'), + '#description' => $this->t('Adds a field with links to switch view modes inline with Ajax. Only works for nodes at this time. It does not work in combination with the reset layout.'), '#default_value' => $config->get('switch_field'), ); $form['fs3']['hidden_region'] = array( '#type' => 'checkbox', - '#title' => t('Hidden region'), - '#description' => t('Add a hidden region to the layouts. Fields will be built but not printed.'), + '#title' => $this->t('Hidden region'), + '#description' => $this->t('Add a hidden region to the layouts. Fields will be built but not printed.'), '#default_value' => $config->get('hidden_region'), ); $form['fs3']['override_node_revision'] = array( '#type' => 'checkbox', - '#title' => t('Custom node revision view mode'), - '#description' => t('Override the node revision page view with a custom view mode'), + '#title' => $this->t('Custom node revision view mode'), + '#description' => $this->t('Override the node revision page view with a custom view mode'), '#default_value' => $config->get('override_node_revision'), ); @@ -275,7 +275,7 @@ function ds_extras_form_ds_admin_form_alter(&$form, FormStateInterface $form_sta $form['fs3']['override_node_revision_view_mode'] = array( '#type' => 'select', - '#description' => t('The revision view mode'), + '#description' => $this->t('The revision view mode'), '#default_value' => $config->get('override_node_revision_view_mode'), '#options' => $options, '#states' => array( @@ -399,7 +399,7 @@ function ds_extras_ds_layout_region_alter($context, &$region_info) { if (isset($region_info['table_regions'])) { $region_info['table_regions'][$block_key] = array( 'title' => Html::escape($block['title']), - 'message' => t('No fields are displayed in this region'), + 'message' => $this->t('No fields are displayed in this region'), ); } } diff --git a/src/Form/ChangeLayoutForm.php b/src/Form/ChangeLayoutForm.php index 7ad2247..695b9f5 100644 --- a/src/Form/ChangeLayoutForm.php +++ b/src/Form/ChangeLayoutForm.php @@ -195,7 +195,7 @@ class ChangeLayoutForm extends FormBase { \Drupal::service('entity_field.manager')->clearCachedFieldDefinitions(); // Show message. - drupal_set_message(t('The layout change has been saved.')); + drupal_set_message($this->t('The layout change has been saved.')); } } diff --git a/src/Form/ClassesForm.php b/src/Form/ClassesForm.php index 64c9530..05f4dca 100644 --- a/src/Form/ClassesForm.php +++ b/src/Form/ClassesForm.php @@ -27,7 +27,7 @@ class ClassesForm extends ConfigFormBase { '#type' => 'textarea', '#title' => $this->t('CSS classes for regions'), '#default_value' => implode("\n", $config->get('classes.region')), - '#description' => t('Configure CSS classes which you can add to regions on the "manage display" screens. Add multiple CSS classes line by line.
If you want to have a friendly name, separate class and friendly name by |, but this is not required. eg:
class_name_1
class_name_2|Friendly name
class_name_3
'), + '#description' => $this->t('Configure CSS classes which you can add to regions on the "manage display" screens. Add multiple CSS classes line by line.
If you want to have a friendly name, separate class and friendly name by |, but this is not required. eg:
class_name_1
class_name_2|Friendly name
class_name_3
'), ); // Only show field classes if DS extras module is enabled. diff --git a/src/Form/EmergencyForm.php b/src/Form/EmergencyForm.php index b80ac68..1406ec4 100644 --- a/src/Form/EmergencyForm.php +++ b/src/Form/EmergencyForm.php @@ -129,7 +129,7 @@ class EmergencyForm extends ConfigFormBase { */ public function submitFieldAttach(array &$form, FormStateInterface $form_state) { $this->state->set('ds.disabled', ($this->state->get('ds.disabled', FALSE) ? FALSE : TRUE)); - drupal_set_message(t('The configuration options have been saved.')); + drupal_set_message($this->t('The configuration options have been saved.')); } /** @@ -162,7 +162,7 @@ class EmergencyForm extends ConfigFormBase { } if ($save) { - drupal_set_message(t('Block regions were removed.')); + drupal_set_message($this->t('Block regions were removed.')); // Clear cached block and ds plugin definitions. \Drupal::service('plugin.manager.block')->clearCachedDefinitions(); diff --git a/src/Form/FieldDeleteForm.php b/src/Form/FieldDeleteForm.php index a86723f..dfb455d 100644 --- a/src/Form/FieldDeleteForm.php +++ b/src/Form/FieldDeleteForm.php @@ -79,7 +79,7 @@ class FieldDeleteForm extends ConfirmFormBase implements ContainerInjectionInter $this->field = $config->get(); if (empty($this->field)) { - drupal_set_message(t('Field not found.')); + drupal_set_message($this->t('Field not found.')); return new RedirectResponse('/admin/structure/ds/fields'); } @@ -102,7 +102,7 @@ class FieldDeleteForm extends ConfirmFormBase implements ContainerInjectionInter // Redirect. $url = new Url('ds.fields_list'); $form_state->setRedirectUrl($url); - drupal_set_message(t('The field @field has been deleted.', array('@field' => $field['label']))); + drupal_set_message($this->t('The field @field has been deleted.', array('@field' => $field['label']))); } /** diff --git a/src/Form/FieldFormBase.php b/src/Form/FieldFormBase.php index 245649f..eb9a671 100644 --- a/src/Form/FieldFormBase.php +++ b/src/Form/FieldFormBase.php @@ -245,7 +245,7 @@ class FieldFormBase extends ConfigFormBase implements ContainerInjectionInterfac // Redirect. $url = new Url('ds.fields_list'); $form_state->setRedirectUrl($url); - drupal_set_message(t('The field %field has been saved.', array('%field' => $field['label']))); + drupal_set_message($this->t('The field %field has been saved.', array('%field' => $field['label']))); } } diff --git a/tests/modules/ds_test/ds_test.module b/tests/modules/ds_test/ds_test.module index cc76756..6d432c2 100644 --- a/tests/modules/ds_test/ds_test.module +++ b/tests/modules/ds_test/ds_test.module @@ -50,7 +50,7 @@ function ds_test_entity_extra_field_info() { // Register a single field to test that // extra fields in the hidden region are really hidden. $extra['node']['article']['display']['heavy_field'] = array( - 'label' => t('Heavy extra test field'), + 'label' => $this->t('Heavy extra test field'), 'weight' => 10, );