You are here

public function GroupController::save in Group 7

Save a group.

Overrides EntityAPIController::save

See also

EntityAPIController::save()

File

classes/group.controller.inc, line 133
Defines the Entity API CRUD class for groups.

Class

GroupController
Controller for group entities.

Code

public function save($entity, DatabaseTransaction $transaction = NULL) {
  $return = parent::save($entity, $transaction);

  // Add Path module support.
  if (module_exists('path')) {
    $this
      ->savePath($entity);
  }

  // Add Pathauto module support.
  if (module_exists('pathauto') && module_exists('entity_token')) {
    module_load_include('inc', 'group', 'group.pathauto');
    group_pathauto_update_alias($entity, empty($entity->is_new) ? 'update' : 'insert');
  }
  return $return;
}