Commit 6c9fb1f2 authored by borisson_'s avatar borisson_ Committed by borisson_

Issue #2839340 by borisson_, harsha012: t() calls should be avoided in classes

parent aeec56f7
......@@ -2,7 +2,7 @@
/**
* @file
* Contains facets.module
* Contains facets.module.
*/
use Drupal\Component\Utility\Html;
......@@ -26,8 +26,10 @@ function facets_help($route_name, RouteMatchInterface $route_match) {
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Facets test') . '</p>';
return $output;
case 'facets.overview':
return t('Below is a list of facets grouped by facetsources they are associated with. A facetsource is the instance where the facet does the actual filtering, for example a View on a Search API index.');
}
}
......@@ -50,9 +52,10 @@ function facets_theme($existing, $type, $theme, $path) {
}
/**
* Implementation of hook_search_api_query_alter.
* Implements hook_search_api_query_alter().
*
* @param \Drupal\search_api\Query\QueryInterface $query
* Generates query for facet search.
*/
function facets_search_api_query_alter(QueryInterface &$query) {
if ($query->getIndex()->getServerInstance()->supportsFeature('search_api_facets')) {
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains core_search_facets.module
* Contains core_search_facets.module.
*/
use Drupal\Core\Database\Query\AlterableInterface;
......@@ -10,7 +10,9 @@ use Drupal\Core\Form\FormStateInterface;
use Drupal\facets\FacetSourceInterface;
/**
* Implements hook_query_TAG_alter(): tag search_$type with $type node_search.
* Implements hook_query_TAG_alter().
*
* Tag search_$type with $type node_search.
*/
function core_search_facets_query_search_node_search_alter(AlterableInterface $query) {
// Obtain the Facet Source id for the current search.
......@@ -40,9 +42,10 @@ function core_search_facets_search_plugin_alter(array &$definitions) {
}
/**
* Implements hook_form_FORM_ID_alter() for facet_source_edit_form.
* Implements hook_form_FORM_ID_alter().
*
* Adds a checkbox to show or hide some advanced filters for the core search.
* Edits the facet_source_edit_form, so we can add a checkbox to show or hide
* some advanced filters for the core search.
*/
function core_search_facets_form_facet_source_edit_form_alter(&$form, FormStateInterface $form_state) {
$request = \Drupal::requestStack()->getMasterRequest();
......
......@@ -258,7 +258,7 @@ class FacetsSummaryForm extends EntityForm {
$form['weights'] = array(
'#type' => 'details',
'#title' => t('Advanced settings'),
'#title' => $this->t('Advanced settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
......
......@@ -252,7 +252,7 @@ class FacetsSummarySettingsForm extends EntityForm {
}
}
else {
drupal_set_message(t('Facet %name has been updated.', ['%name' => $facets_summary->getName()]));
drupal_set_message($this->t('Facet %name has been updated.', ['%name' => $facets_summary->getName()]));
}
// Clear Drupal cache for blocks to reflect recent changes.
......
......@@ -358,7 +358,7 @@ class DefaultFacetManager {
'class' => 'facet-empty',
],
'empty_text' => [
'#markup' => t($empty_behavior['text']),
'#markup' => $this->t($empty_behavior['text']),
],
],
];
......
......@@ -343,9 +343,9 @@ class FacetForm extends EntityForm {
$empty_behavior_config = $facet->getEmptyBehavior();
$form['facet_settings']['empty_behavior'] = [
'#type' => 'radios',
'#title' => t('Empty facet behavior'),
'#title' => $this->t('Empty facet behavior'),
'#default_value' => $empty_behavior_config['behavior'] ?: 'none',
'#options' => ['none' => t('Do not display facet'), 'text' => t('Display text')],
'#options' => ['none' => $this->t('Do not display facet'), 'text' => $this->t('Display text')],
'#description' => $this->t('The action to take when a facet has no items.'),
'#required' => TRUE,
];
......@@ -464,7 +464,7 @@ class FacetForm extends EntityForm {
$form['weights'] = array(
'#type' => 'details',
'#title' => t('Advanced settings'),
'#title' => $this->t('Advanced settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
......@@ -659,7 +659,7 @@ class FacetForm extends EntityForm {
$facet->setEnableParentWhenChildGetsDisabled($form_state->getValue(['facet_settings', 'enable_parent_when_child_gets_disabled']));
$facet->save();
drupal_set_message(t('Facet %name has been updated.', ['%name' => $facet->getName()]));
drupal_set_message($this->t('Facet %name has been updated.', ['%name' => $facet->getName()]));
}
/**
......
......@@ -337,7 +337,7 @@ class FacetSettingsForm extends EntityForm {
}
}
else {
drupal_set_message(t('Facet %name has been updated.', ['%name' => $facet->getName()]));
drupal_set_message($this->t('Facet %name has been updated.', ['%name' => $facet->getName()]));
}
// Clear Drupal cache for blocks to reflect recent changes.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment