You are here

protected function GroupMedia::getTargetEntityPermissions in Group Media 8

Provides permissions for the actual entity being added to the group.

Return value

array An array of group permissions, see ::getPermissions for more info.

Overrides GroupContentEnablerBase::getTargetEntityPermissions

Deprecated

in Group 1.0, will be removed before Group 2.0.

See also

GroupContentEnablerInterface::getPermissions()

File

src/Plugin/GroupContentEnabler/GroupMedia.php, line 63

Class

GroupMedia
Provides a content enabler for nodes.

Namespace

Drupal\groupmedia\Plugin\GroupContentEnabler

Code

protected function getTargetEntityPermissions() {
  $permissions = parent::getTargetEntityPermissions();
  $plugin_id = $this
    ->getPluginId();

  // Add a 'view unpublished' permission by re-using most of the 'view' one.
  $original = $permissions["view {$plugin_id} entity"];
  $permissions["view unpublished {$plugin_id} entity"] = [
    'title' => str_replace('View ', 'View unpublished ', $original['title']),
  ] + $original;
  return $permissions;
}