replaced deprecated functions

This commit is contained in:
naomi 2021-11-27 15:19:16 +00:00
parent 3458949bb0
commit d4e8991804
16 changed files with 23 additions and 23 deletions

View File

@ -107,7 +107,7 @@ class OCCaseRevisionDeleteForm extends ConfirmFormBase {
$this->OCCaseStorage->deleteRevision($this->revision->getRevisionId());
$this->logger('content')->notice('Case: deleted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]);
drupal_set_message(t('Revision from %revision-date of Case %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()]));
\Drupal::messenger()->addMessage(t('Revision from %revision-date of Case %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()]));
$form_state->setRedirect(
'entity.oc_case.canonical',
['oc_case' => $this->revision->id()]

View File

@ -120,7 +120,7 @@ class OCCaseRevisionRevertForm extends ConfirmFormBase {
$this->revision->save();
$this->logger('content')->notice('Case: reverted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]);
drupal_set_message(t('Case %title has been reverted to the revision from %revision-date.', ['%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)]));
\Drupal::messenger()->addMessage(t('Case %title has been reverted to the revision from %revision-date.', ['%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)]));
$form_state->setRedirect(
'entity.oc_case.version_history',
['oc_case' => $this->revision->id()]

View File

@ -38,7 +38,7 @@ class OCCaseTypeDeleteForm extends EntityConfirmFormBase {
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity->delete();
drupal_set_message(
\Drupal::messenger()->addMessage(
$this->t('content @type: deleted @label.',
[
'@type' => $this->entity->bundle(),

View File

@ -49,13 +49,13 @@ class OCCaseTypeForm extends EntityForm {
switch ($status) {
case SAVED_NEW:
drupal_set_message($this->t('Created the %label Case type.', [
\Drupal::messenger()->addMessage($this->t('Created the %label Case type.', [
'%label' => $oc_case_type->label(),
]));
break;
default:
drupal_set_message($this->t('Saved the %label Case type.', [
\Drupal::messenger()->addMessage($this->t('Saved the %label Case type.', [
'%label' => $oc_case_type->label(),
]));
}

View File

@ -55,19 +55,19 @@ class OCActivityForm extends ContentEntityForm {
switch ($status) {
case SAVED_NEW:
drupal_set_message($this->t('Created the %bundle.', [
\Drupal::messenger()->addMessage($this->t('Created the %bundle.', [
'%bundle' => $entity->bundle(),
]));
break;
default:
drupal_set_message($this->t('Saved the %bundle.', [
\Drupal::messenger()->addMessage($this->t('Saved the %bundle.', [
'%bundle' => $entity->bundle(),
]));
}
// If you have unpublished the entity and you can't see unpublished entities, redirect to a more informative message than just "Access Denied".
if (!$form_state->getValue('status')['value'] && !\Drupal::currentUser()->hasPermission('view unpublished activity entities')) {
drupal_set_message($this->t('The %bundle is now unpublished & hidden from you.', [
\Drupal::messenger()->addMessage($this->t('The %bundle is now unpublished & hidden from you.', [
'%bundle' => $entity->bundle(),
]));
$form_state->setRedirect('<front>');

View File

@ -107,7 +107,7 @@ class OCActivityRevisionDeleteForm extends ConfirmFormBase {
$this->OCActivityStorage->deleteRevision($this->revision->getRevisionId());
$this->logger('content')->notice('Activity: deleted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]);
drupal_set_message(t('Revision from %revision-date of Activity %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()]));
\Drupal::messenger()->addMessage(t('Revision from %revision-date of Activity %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()]));
$form_state->setRedirect(
'entity.oc_activity.canonical',
['oc_activity' => $this->revision->id()]

View File

@ -120,7 +120,7 @@ class OCActivityRevisionRevertForm extends ConfirmFormBase {
$this->revision->save();
$this->logger('content')->notice('Activity: reverted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]);
drupal_set_message(t('Activity %title has been reverted to the revision from %revision-date.', ['%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)]));
\Drupal::messenger()->addMessage(t('Activity %title has been reverted to the revision from %revision-date.', ['%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)]));
$form_state->setRedirect(
'entity.oc_activity.version_history',
['oc_activity' => $this->revision->id()]

View File

@ -38,7 +38,7 @@ class OCActivityTypeDeleteForm extends EntityConfirmFormBase {
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity->delete();
drupal_set_message(
\Drupal::messenger()->addMessage(
$this->t('content @type: deleted @label.',
[
'@type' => $this->entity->bundle(),

View File

@ -49,13 +49,13 @@ class OCActivityTypeForm extends EntityForm {
switch ($status) {
case SAVED_NEW:
drupal_set_message($this->t('Created the %label Activity type.', [
\Drupal::messenger()->addMessage($this->t('Created the %label Activity type.', [
'%label' => $oc_activity_type->label(),
]));
break;
default:
drupal_set_message($this->t('Saved the %label Activity type.', [
\Drupal::messenger()->addMessage($this->t('Saved the %label Activity type.', [
'%label' => $oc_activity_type->label(),
]));
}

View File

@ -48,19 +48,19 @@ class OCActorForm extends ContentEntityForm {
switch ($status) {
case SAVED_NEW:
drupal_set_message($this->t('Created %label.', [
\Drupal::messenger()->addMessage($this->t('Created %label.', [
'%label' => $entity->label(),
]));
break;
default:
drupal_set_message($this->t('Saved %label.', [
\Drupal::messenger()->addMessage($this->t('Saved %label.', [
'%label' => $entity->label(),
]));
}
// If you have unpublished the entity and you can't see unpublished entities, redirect to a more informative message than just "Access Denied".
if (!$form_state->getValue('status')['value'] && !\Drupal::currentUser()->hasPermission('view unpublished actor entities')) {
drupal_set_message($this->t('The record for "%label" is now unpublished & hidden from you.', [
\Drupal::messenger()->addMessage($this->t('The record for "%label" is now unpublished & hidden from you.', [
'%label' => $entity->label(),
]));
$form_state->setRedirect('<front>');

View File

@ -107,7 +107,7 @@ class OCActorRevisionDeleteForm extends ConfirmFormBase {
$this->OCActorStorage->deleteRevision($this->revision->getRevisionId());
$this->logger('content')->notice('Actor: deleted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]);
drupal_set_message(t('Revision from %revision-date of Actor %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()]));
\Drupal::messenger()->addMessage(t('Revision from %revision-date of Actor %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()]));
$form_state->setRedirect(
'entity.oc_actor.canonical',
['oc_actor' => $this->revision->id()]

View File

@ -120,7 +120,7 @@ class OCActorRevisionRevertForm extends ConfirmFormBase {
$this->revision->save();
$this->logger('content')->notice('Actor: reverted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]);
drupal_set_message(t('Actor %title has been reverted to the revision from %revision-date.', ['%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)]));
\Drupal::messenger()->addMessage(t('Actor %title has been reverted to the revision from %revision-date.', ['%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)]));
$form_state->setRedirect(
'entity.oc_actor.version_history',
['oc_actor' => $this->revision->id()]

View File

@ -38,7 +38,7 @@ class OCActorTypeDeleteForm extends EntityConfirmFormBase {
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity->delete();
drupal_set_message(
\Drupal::messenger()->addMessage(
$this->t('content @type: deleted @label.',
[
'@type' => $this->entity->bundle(),

View File

@ -49,13 +49,13 @@ class OCActorTypeForm extends EntityForm {
switch ($status) {
case SAVED_NEW:
drupal_set_message($this->t('Created the %label Person type.', [
\Drupal::messenger()->addMessage($this->t('Created the %label Person type.', [
'%label' => $oc_actor_type->label(),
]));
break;
default:
drupal_set_message($this->t('Saved the %label Person type.', [
\Drupal::messenger()->addMessage($this->t('Saved the %label Person type.', [
'%label' => $oc_actor_type->label(),
]));
}

View File

@ -62,7 +62,7 @@ class OCEventForm extends ContentEntityForm {
}
// If you have unpublished the entity and you can't see unpublished entities, redirect to a more informative message than just "Access Denied".
if (!$form_state->getValue('status')['value'] && !\Drupal::currentUser()->hasPermission('view unpublished event entities')) {
drupal_set_message($this->t('The record for "%label" is now unpublished & hidden from you.', [
\Drupal::messenger()->addMessage($this->t('The record for "%label" is now unpublished & hidden from you.', [
'%label' => $entity->label(),
]));
$form_state->setRedirect('<front>');

View File

@ -83,7 +83,7 @@ class OCOrganisationForm extends ContentEntityForm {
}
// If you have unpublished the entity and you can't see unpublished entities, redirect to a more informative message than just "Access Denied".
if (!$form_state->getValue('status')['value'] && !\Drupal::currentUser()->hasPermission('view unpublished organisation entities')) {
drupal_set_message($this->t('The record for "%label" is now unpublished & hidden from you.', [
\Drupal::messenger()->addMessage($this->t('The record for "%label" is now unpublished & hidden from you.', [
'%label' => $entity->label(),
]));
$form_state->setRedirect('<front>');