Updating Media dependent modules to versions compatible with core Media.
[yaffs-website] / web / modules / contrib / media_entity_actions / src / Plugin / Action / DeleteMedia.php
similarity index 84%
rename from web/modules/contrib/media_entity/src/Plugin/Action/DeleteMedia.php
rename to web/modules/contrib/media_entity_actions/src/Plugin/Action/DeleteMedia.php
index b2a98d2ebf9ef8c3fa9cd9bfe45b17a1acb95ec9..279f744e29599e9d52bcdbcc63f53010bdf68ba2 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\media_entity\Plugin\Action;
+namespace Drupal\media_entity_actions\Plugin\Action;
 
 use Drupal\Core\Action\ActionBase;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
@@ -9,21 +9,21 @@ use Drupal\user\PrivateTempStoreFactory;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
- * Redirects to a media deletion form.
+ * Redirects to a media item deletion form.
  *
  * @Action(
  *   id = "media_delete_action",
  *   label = @Translation("Delete media"),
  *   type = "media",
- *   confirm_form_route_name = "entity.media.multiple_delete_confirm"
+ *   confirm_form_route_name = "entity.media.multiple_delete_confirm",
  * )
  */
 class DeleteMedia extends ActionBase implements ContainerFactoryPluginInterface {
 
   /**
-   * The tempstore object.
+   * The temp store factory.
    *
-   * @var \Drupal\user\SharedTempStore
+   * @var \Drupal\user\PrivateTempStoreFactory
    */
   protected $tempStore;
 
@@ -44,8 +44,8 @@ class DeleteMedia extends ActionBase implements ContainerFactoryPluginInterface
    * @param mixed $plugin_definition
    *   The plugin implementation definition.
    * @param \Drupal\user\PrivateTempStoreFactory $temp_store_factory
-   *   The tempstore factory.
-   * @param AccountInterface $current_user
+   *   The temp store factory.
+   * @param \Drupal\Core\Session\AccountInterface $current_user
    *   Current user.
    */
   public function __construct(array $configuration, $plugin_id, $plugin_definition, PrivateTempStoreFactory $temp_store_factory, AccountInterface $current_user) {
@@ -72,7 +72,7 @@ class DeleteMedia extends ActionBase implements ContainerFactoryPluginInterface
    */
   public function executeMultiple(array $entities) {
     $info = [];
-    /** @var \Drupal\media_entity\MediaInterface $media */
+    /** @var \Drupal\media\MediaInterface $media */
     foreach ($entities as $media) {
       $langcode = $media->language()->getId();
       $info[$media->id()][$langcode] = $langcode;
@@ -84,14 +84,14 @@ class DeleteMedia extends ActionBase implements ContainerFactoryPluginInterface
    * {@inheritdoc}
    */
   public function execute($object = NULL) {
-    $this->executeMultiple(array($object));
+    $this->executeMultiple($object ? [$object] : []);
   }
 
   /**
    * {@inheritdoc}
    */
   public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
-    /** @var \Drupal\media_entity\MediaInterface $object */
+    /** @var \Drupal\media\MediaInterface $object */
     return $object->access('delete', $account, $return_as_object);
   }