You are here

class OgMenuEventSubscriber in Organic Groups Menu (OG Menu) 8

Event subscribers for OG Menu.

Hierarchy

  • class \Drupal\og_menu\EventSubscriber\OgMenuEventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of OgMenuEventSubscriber

1 string reference to 'OgMenuEventSubscriber'
og_menu.services.yml in ./og_menu.services.yml
og_menu.services.yml
1 service uses OgMenuEventSubscriber
og_menu.event_subscriber in ./og_menu.services.yml
Drupal\og_menu\EventSubscriber\OgMenuEventSubscriber

File

src/EventSubscriber/OgMenuEventSubscriber.php, line 13

Namespace

Drupal\og_menu\EventSubscriber
View source
class OgMenuEventSubscriber implements EventSubscriberInterface {

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    return [
      PermissionEventInterface::EVENT_NAME => [
        [
          'provideDefaultOgPermissions',
        ],
      ],
    ];
  }

  /**
   * Provides default OG permissions.
   *
   * @param \Drupal\og\Event\PermissionEventInterface $event
   *   The OG permission event.
   */
  public function provideDefaultOgPermissions(PermissionEventInterface $event) {

    // @todo Make granular per OG Menu instance.
    $event
      ->setPermissions([
      new GroupPermission([
        'name' => 'add new links to og menu instance entities',
        'title' => t('Add new links to OG Menu instance entities'),
        'default roles' => [
          OgRoleInterface::ADMINISTRATOR,
        ],
      ]),
    ]);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
OgMenuEventSubscriber::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to.
OgMenuEventSubscriber::provideDefaultOgPermissions public function Provides default OG permissions.