Commit dbea6220 authored by amit.drupal's avatar amit.drupal Committed by borisson_

Issue #3047680 by amit.drupal, Akanksha92, idebr, borisson_: Replace calls to...

Issue #3047680 by amit.drupal, Akanksha92, idebr, borisson_: Replace calls to deprecated function drupal_set_message() with the Messenger service
parent af5c8dfa
......@@ -400,7 +400,7 @@ class FacetsSummaryForm extends EntityForm {
$facets_summary->setFacets((array) $enabled_facets);
$facets_summary->save();
drupal_set_message($this->t('Facets Summary %name has been updated.', ['%name' => $facets_summary->getName()]));
\Drupal::messenger()->addMessage($this->t('Facets Summary %name has been updated.', ['%name' => $facets_summary->getName()]));
}
/**
......
......@@ -194,7 +194,7 @@ class FacetsSummarySettingsForm extends EntityForm {
if ($is_new) {
if ($this->moduleHandler->moduleExists('block')) {
$message = $this->t('Facet Summary %name has been created. Go to the <a href=":block_overview">Block overview page</a> to place the new block in the desired region.', ['%name' => $facets_summary->getName(), ':block_overview' => $this->urlGenerator->generateFromRoute('block.admin_display')]);
drupal_set_message($message);
\Drupal::messenger()->addMessage($message);
$form_state->setRedirect('entity.facets_summary.edit_form', ['facets_summary' => $facets_summary->id()]);
}
......@@ -222,7 +222,7 @@ class FacetsSummarySettingsForm extends EntityForm {
}
}
else {
drupal_set_message($this->t('Facet %name has been updated.', ['%name' => $facets_summary->getName()]));
\Drupal::messenger()->addMessage($this->t('Facet %name has been updated.', ['%name' => $facets_summary->getName()]));
}
// Clear Drupal cache for blocks to reflect recent changes.
......@@ -241,7 +241,7 @@ class FacetsSummarySettingsForm extends EntityForm {
if ($view !== NULL) {
$view->display_handler->overrideOption('cache', ['type' => 'none']);
$view->save();
drupal_set_message($this->t('Caching of view %view has been disabled.', ['%view' => $view->storage->label()]));
\Drupal::messenger()->addMessage($this->t('Caching of view %view has been disabled.', ['%view' => $view->storage->label()]));
}
}
......
......@@ -300,7 +300,7 @@ class FacetListBuilder extends DraggableListBuilder {
// message to notify users how to resolve their broken facets.
if (substr($facet->getFacetSourceId(), 0, 16) == 'core_node_search') {
$project_link = Link::fromTextAndUrl('https://www.drupal.org/project/facets_core_search', Url::fromUri('https://www.drupal.org/project/facets_core_search'))->toString();
drupal_set_message(t('Core search facets has been moved to a separate project. You need to download and enable this module from @project_link to continue using your core search facets.', ['@project_link' => $project_link]), 'error');
\Drupal::messenger()->addError(t('Core search facets has been moved to a separate project. You need to download and enable this module from @project_link to continue using your core search facets.', ['@project_link' => $project_link]), 'error');
}
$form['facets'][$facet->id()] = $this->buildRow($facet);
$form['facets'][$facet->id()]['weight']['#attributes']['class'][] = $subgroup_class;
......@@ -328,7 +328,7 @@ class FacetListBuilder extends DraggableListBuilder {
$entity->setWeight($entity_values['weight']);
$entity->save();
}
drupal_set_message(t('The facets have been updated.'));
\Drupal::messenger()->addMessage(t('The facets have been updated.'));
}
/**
......
......@@ -71,7 +71,7 @@ class FacetCloneForm extends EntityForm {
if (strpos($facet->getFacetSourceId(), 'search_api:') === FALSE) {
// We don't know how to clone other kinds of facets.
drupal_set_message($this->t('We can only clone Search API based facets.'));
\Drupal::messenger()->addMessage($this->t('We can only clone Search API based facets.'));
return [];
}
......@@ -150,7 +150,7 @@ class FacetCloneForm extends EntityForm {
$facet->set('facet_source_id', $form_state->getValue('destination_facet_source'));
$facet->save();
drupal_set_message($this->t('Facet cloned to :label', [':label' => $facet->label()]));
\Drupal::messenger()->addMessage($this->t('Facet cloned to :label', [':label' => $facet->label()]));
// Redirect the user to the view admin form.
$form_state->setRedirectUrl($facet->toUrl('edit-form'));
......
......@@ -37,7 +37,7 @@ class FacetDeleteConfirmForm extends EntityConfirmFormBase {
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity->delete();
drupal_set_message($this->t('The facet %name has been deleted.', ['%name' => $this->entity->label()]));
\Drupal::messenger()->addMessage($this->t('The facet %name has been deleted.', ['%name' => $this->entity->label()]));
$form_state->setRedirect('facets.overview');
}
......
......@@ -717,7 +717,7 @@ class FacetForm extends EntityForm {
$facet->set('show_title', $form_state->getValue(['facet_settings', 'show_title'], FALSE));
$facet->save();
drupal_set_message($this->t('Facet %name has been updated.', ['%name' => $facet->getName()]));
\Drupal::messenger()->addMessage($this->t('Facet %name has been updated.', ['%name' => $facet->getName()]));
}
/**
......
......@@ -289,12 +289,12 @@ class FacetSettingsForm extends EntityForm {
if ($is_new) {
if ($this->moduleHandler->moduleExists('block')) {
$message = $this->t('Facet %name has been created. Go to the <a href=":block_overview">Block overview page</a> to place the new block in the desired region.', ['%name' => $facet->getName(), ':block_overview' => $this->urlGenerator->generateFromRoute('block.admin_display')]);
drupal_set_message($message);
\Drupal::messenger()->addMessage($message);
$form_state->setRedirect('entity.facets_facet.edit_form', ['facets_facet' => $facet->id()]);
}
}
else {
drupal_set_message($this->t('Facet %name has been updated.', ['%name' => $facet->getName()]));
\Drupal::messenger()->addMessage($this->t('Facet %name has been updated.', ['%name' => $facet->getName()]));
}
list($type,) = explode(':', $facet_source_id);
......@@ -312,7 +312,7 @@ class FacetSettingsForm extends EntityForm {
}
$view->display_handler->overrideOption('cache', ['type' => 'none']);
$view->save();
drupal_set_message($this->t('Caching of view %view has been disabled.', ['%view' => $view->storage->label()]));
\Drupal::messenger()->addMessage($this->t('Caching of view %view has been disabled.', ['%view' => $view->storage->label()]));
}
}
......
......@@ -177,7 +177,7 @@ class FacetSourceEditForm extends EntityForm {
public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
$facet_source = $this->getEntity();
drupal_set_message($this->t('Facet source %name has been saved.', ['%name' => $facet_source->label()]));
\Drupal::messenger()->addMessage($this->t('Facet source %name has been saved.', ['%name' => $facet_source->label()]));
$form_state->setRedirect('entity.facets_facet.collection');
}
......
......@@ -43,7 +43,7 @@ class TestPreQuery extends ProcessorPluginBase implements PreQueryProcessorInter
* {@inheritdoc}
*/
public function preQuery(FacetInterface $facet) {
drupal_set_message($this->getConfiguration()['test_value']);
\Drupal::messenger()->addMessage($this->getConfiguration()['test_value']);
}
/**
......
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