You are here

function group_install in Group 7

Implements hook_install().

See also

group_form()

File

./group.install, line 12
Install, update and uninstall functions for the Group project.

Code

function group_install() {
  $t = get_t();

  // Enable the editing of Group entities in the admin theme.
  variable_set('group_admin_theme', '1');

  // Add Pathauto module support.
  //
  // Setting a default pattern will trigger the Pathauto UI to show up on group
  // forms even though we're not sure whether the soft dependency Entity tokens
  // is enabled.
  //
  // Because we still want to indicate the possibility of using Pathauto with
  // Group instead of not setting a default pattern at all when Entity tokens is
  // disabled, we alter the Pathauto form in group_form().
  variable_set('pathauto_group_pattern', 'group/[group:title]');

  // Create a first global admin role and give it full permissions.
  $group_admin = entity_create('group_role', array(
    'name' => 'group_admin',
    'label' => $t('Administrator'),
    'weight' => 10,
    'permissions' => array_keys(module_invoke_all('group_permission')),
  ));
  $group_admin
    ->save();
}