Moves files between public and private file storage
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.0 KiB

<?php
/**
* @file
* Install and update hooks for Media File Privacy.
*/
use Drupal\system\Entity\Action;
/**
* Adds the node action for moving associated unpublished media files private.
*/
function media_file_privacy_update_10001(): void {
$id = 'media_file_privacy_move_node_media_private';
if (!Action::load($id)) {
Action::create([
'id' => $id,
'label' => 'Move associated unpublished media files to private storage',
'type' => 'node',
'plugin' => 'media_file_privacy_move_node_media_private',
'configuration' => [],
])->save();
}
}
/**
* Adds the node action for moving associated published media files public.
*/
function media_file_privacy_update_10002(): void {
$id = 'media_file_privacy_move_node_media_public';
if (!Action::load($id)) {
Action::create([
'id' => $id,
'label' => 'Move associated published media files to public storage',
'type' => 'node',
'plugin' => 'media_file_privacy_move_node_media_public',
'configuration' => [],
])->save();
}
}