opigno_calendar_event.install in Opigno calendar event 3.x
Same filename and directory in other branches
Install, update and uninstall functions for the Opigno Calendar Event module.
File
opigno_calendar_event.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the Opigno Calendar Event module.
*/
use Drupal\user\Entity\Role;
use Drupal\user\RoleInterface;
/**
* Implements hook_install().
*/
function opigno_calendar_event_install() {
opigno_calendar_event_set_permissions();
}
/**
* Sets roles opigno calendar event permissions.
*/
function opigno_calendar_event_set_permissions() {
$role = Role::load(RoleInterface::AUTHENTICATED_ID);
$role
->grantPermission('create opigno_calendar_event');
$role
->grantPermission('view own opigno calendar event');
$role
->grantPermission('update own opigno calendar event');
$role
->grantPermission('delete own opigno calendar event');
$role
->grantPermission('add members to calendar event');
$role
->save();
$role = Role::load('content_manager');
$role
->grantPermission('view opigno_calendar_event');
$role
->grantPermission('update opigno_calendar_event');
$role
->grantPermission('delete opigno_calendar_event');
$role
->grantPermission('add any members to calendar event');
$role
->save();
$role = Role::load('user_manager');
$role
->grantPermission('view opigno_calendar_event');
$role
->grantPermission('update opigno_calendar_event');
$role
->grantPermission('delete opigno_calendar_event');
$role
->grantPermission('add any members to calendar event');
$role
->save();
}
Functions
Name | Description |
---|---|
opigno_calendar_event_install | Implements hook_install(). |
opigno_calendar_event_set_permissions | Sets roles opigno calendar event permissions. |