You are here

pmperson.module in Drupal PM (Project Management) 8

Hook implementations for the pmperson module.

File

pmperson/pmperson.module
View source
<?php

/**
 * @file
 * Hook implementations for the pmperson module.
 */
define('PMPERSON_RESOLVE_DEPENDENCIES_LINK', 'admin/config/pm/pmperson_migration');

/**
 * Implements hook_menu().
 */
function pmperson_menu() {
  module_load_include('inc', 'pmperson', 'includes/pmperson.migrate');
  $items = array();
  if (pmperson_migrate_update_could_be_performed() == FALSE) {
    $items[PMPERSON_RESOLVE_DEPENDENCIES_LINK] = array(
      'title' => 'PM Person migration conflicts',
      'page callback' => 'pmperson_migrate_page_callback',
      'access callback' => 'pmperson_update_access_allowed',
      'type' => MENU_NORMAL_ITEM,
      'file' => 'includes/pmperson.migrate.inc',
    );
  }
  return $items;
}

/**
 * Access check for resolving conflicts.
 *
 * @see update_access_allowed()
 */
function pmperson_update_access_allowed() {
  global $update_free_access, $user;

  // Allow the global variable in settings.php to override the access check.
  if (!empty($update_free_access)) {
    return TRUE;
  }

  // Calls to user_access() might fail during the Drupal 6 to 7 update process,
  // so we fall back on requiring that the user be logged in as user #1.
  try {
    require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'user') . '/user.module';
    return user_access('administer software updates');
  } catch (Exception $e) {
    return $user->uid == 1;
  }
}

/**
 * Implements hook_forms().
 */
function pmperson_forms($form_id, $args) {
  $forms = array();
  if (substr($form_id, 0, 35) == 'pmperson_migrate_email_adjust_form_') {
    $forms[$form_id] = array(
      'callback' => 'pmperson_migrate_email_adjust_form',
    );
  }
  return $forms;
}

/**
 * Implements hook_permission().
 */
function pmperson_permission() {
  return array(
    'Project Management Person: access' => array(
      'title' => t('Access PM Person'),
      'description' => t('Allows the user to see pages and blocks associated with the PM Person module, but does not control which persons are shown within them.'),
    ),
  );
}

/**
 * Implements hook_ctools_plugin_api().
 */
function pmperson_ctools_plugin_api($module = NULL, $api = NULL) {
  if ($module == "field_group" && $api == "field_group") {
    return array(
      "version" => "1",
    );
  }
}

Functions

Namesort descending Description
pmperson_ctools_plugin_api Implements hook_ctools_plugin_api().
pmperson_forms Implements hook_forms().
pmperson_menu Implements hook_menu().
pmperson_permission Implements hook_permission().
pmperson_update_access_allowed Access check for resolving conflicts.

Constants

Namesort descending Description
PMPERSON_RESOLVE_DEPENDENCIES_LINK @file Hook implementations for the pmperson module.