MediaBulkConfigPermissions.php in Media Bulk Upload 8
File
src/MediaBulkConfigPermissions.php
View source
<?php
namespace Drupal\media_bulk_upload;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\media_bulk_upload\Entity\MediaBulkConfig;
class MediaBulkConfigPermissions {
use StringTranslationTrait;
public function mediaBulkConfigPermissions() {
$perms = [];
foreach (MediaBulkConfig::loadMultiple() as $mediaBulkConfig) {
$perms += $this
->buildPermissions($mediaBulkConfig);
}
return $perms;
}
protected function buildPermissions(MediaBulkConfig $mediaBulkConfig) {
$mediaBulkConfigId = $mediaBulkConfig
->id();
$type_params = [
'%type_name' => $mediaBulkConfig
->label(),
];
return [
"use {$mediaBulkConfigId} bulk upload form" => [
'title' => $this
->t('%type_name : Use upload form', $type_params),
],
];
}
}