You are here

function commons_update_3103 in Drupal Commons 7.3

Replace the Toolbar module with the Navbar module.

File

./commons.install, line 627
Install, update and uninstall functions for the Commons install profile.

Code

function commons_update_3103() {

  // Enable the Navbar module and its dependencies.
  $module_list = array(
    'breakpoints',
    'navbar',
  );
  module_enable($module_list);

  // Migrate permissions.
  if (module_exists('toolbar')) {
    $roles = user_roles(FALSE, 'access toolbar');
    if (!empty($roles)) {

      // Set permissions.
      foreach ($roles as $rid => $role) {
        user_role_grant_permissions($rid, array(
          'access navbar',
        ));
      }
    }
  }

  // Disable the Toolbar module.
  $module_list = array(
    'toolbar',
  );
  module_disable($module_list);
  return array();
}