You are here

public function MediaRevisionPermissions::mediaRevisionTypePermissions in Media Revisions UI 8

Same name and namespace in other branches
  1. 2.0.x src/MediaRevisionPermissions.php \Drupal\media_revisions_ui\MediaRevisionPermissions::mediaRevisionTypePermissions()

Returns an array of media revision type permissions.

Return value

array The media type permissions.

See also

\Drupal\user\PermissionHandlerInterface::getPermissions()

1 string reference to 'MediaRevisionPermissions::mediaRevisionTypePermissions'
media_revisions_ui.permissions.yml in ./media_revisions_ui.permissions.yml
media_revisions_ui.permissions.yml

File

src/MediaRevisionPermissions.php, line 50

Class

MediaRevisionPermissions
Provides dynamic permissions for each media revision type.

Namespace

Drupal\media_revisions_ui

Code

public function mediaRevisionTypePermissions() {
  $perms = [];

  // Generate media revision permissions for all media types.
  $media_types = $this->entityTypeManager
    ->getStorage('media_type')
    ->loadMultiple();
  foreach ($media_types as $type) {
    $perms += $this
      ->buildPermissions($type);
  }
  return $perms;
}