You are here

protected function GroupEvent::getTargetEntityPermissions in Event 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

modules/gevent/src/Plugin/GroupContentEnabler/GroupEvent.php, line 61

Class

GroupEvent
Provides a content enabler for events.

Namespace

Drupal\gevent\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;
}