Added Entity and Entity Reference Revisions which got dropped somewhere along the...
[yaffs-website] / web / core / modules / views_ui / src / Form / BreakLockForm.php
index 94a626f2734e5e30f32dc617c9f0e109d102fa14..91535750c3c6dfe6bff84cdbf12cb7a46fcd1634 100644 (file)
@@ -5,11 +5,13 @@ namespace Drupal\views_ui\Form;
 use Drupal\Core\Entity\EntityConfirmFormBase;
 use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Form\FormStateInterface;
-use Drupal\user\SharedTempStoreFactory;
+use Drupal\Core\TempStore\SharedTempStoreFactory;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
  * Builds the form to break the lock of an edited view.
+ *
+ * @internal
  */
 class BreakLockForm extends EntityConfirmFormBase {
 
@@ -21,9 +23,9 @@ class BreakLockForm extends EntityConfirmFormBase {
   protected $entityManager;
 
   /**
-   * Stores the user tempstore.
+   * Stores the shared tempstore.
    *
-   * @var \Drupal\user\SharedTempStore
+   * @var \Drupal\Core\TempStore\SharedTempStore
    */
   protected $tempStore;
 
@@ -32,7 +34,7 @@ class BreakLockForm extends EntityConfirmFormBase {
    *
    * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
    *   The Entity manager.
-   * @param \Drupal\user\SharedTempStoreFactory $temp_store_factory
+   * @param \Drupal\Core\TempStore\SharedTempStoreFactory $temp_store_factory
    *   The factory for the temp store object.
    */
   public function __construct(EntityManagerInterface $entity_manager, SharedTempStoreFactory $temp_store_factory) {
@@ -46,7 +48,7 @@ class BreakLockForm extends EntityConfirmFormBase {
   public static function create(ContainerInterface $container) {
     return new static(
       $container->get('entity.manager'),
-      $container->get('user.shared_tempstore')
+      $container->get('tempstore.shared')
     );
   }
 
@@ -74,7 +76,7 @@ class BreakLockForm extends EntityConfirmFormBase {
       '#theme' => 'username',
       '#account' => $account,
     ];
-    return $this->t('By breaking this lock, any unsaved changes made by @user will be lost.', ['@user' => drupal_render($username)]);
+    return $this->t('By breaking this lock, any unsaved changes made by @user will be lost.', ['@user' => \Drupal::service('renderer')->render($username)]);
   }
 
   /**
@@ -108,7 +110,7 @@ class BreakLockForm extends EntityConfirmFormBase {
   public function submitForm(array &$form, FormStateInterface $form_state) {
     $this->tempStore->delete($this->entity->id());
     $form_state->setRedirectUrl($this->entity->urlInfo('edit-form'));
-    drupal_set_message($this->t('The lock has been broken and you may now edit this view.'));
+    $this->messenger()->addStatus($this->t('The lock has been broken and you may now edit this view.'));
   }
 
 }