+ $this->messenger()->addStatus($this->t('@type %label has been updated.', $t_args));
+ }
+
+ // Redirect the user to the media overview if the user has the 'access media
+ // overview' permission. If not, redirect to the canonical URL of the media
+ // item.
+ if ($this->currentUser()->hasPermission('access media overview')) {
+ $form_state->setRedirectUrl($this->entity->toUrl('collection'));
+ }
+ else {
+ $form_state->setRedirectUrl($this->entity->toUrl());