You are here

data_export_import.module in Data export import 7

Same filename and directory in other branches
  1. 6 data_export_import.module

A module to enable content data to be exported and imported.

File

data_export_import.module
View source
<?php

/**
 * @file
 * A module to enable content data to be exported and imported.
 */

/**
 * Implements hook_help().
 */
function data_export_import_help($path, $arg) {
  if ($path == 'admin/help#data_export_import') {
    return t('Exports datasets as files which can then imported into other Drupal instances.');
  }
}

/**
 * Implements hook_permission().
 */
function data_export_import_permission() {
  return array(
    'access data export import' => array(
      'title' => t('Access Data Export Import Functions.'),
      'description' => t('Allows users to use all functions which are part of the Data Export Import module.'),
      'restrict access' => FALSE,
    ),
  );
}

/**
 * Implements hook_menu().
 */
function data_export_import_menu() {
  $items = array();

  // This will lay out the various tabs used to export and import
  // data.  Tabs will also use the 'file' option to include the file
  // containing the callback function and other functions.
  $items['admin/config/system/data_export_import'] = array(
    'title' => 'Data export import',
    'page callback' => 'data_export_import_callback_overview',
    'access arguments' => array(
      'access data export import',
    ),
    'description' => 'Data export import',
    'type' => MENU_NORMAL_ITEM,
  );
  $items['admin/config/system/data_export_import/overview'] = array(
    'title' => 'Overview',
    'weight' => 0,
    'description' => 'Data export import introduction',
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['admin/config/system/data_export_import/nodes'] = array(
    'title' => 'Nodes',
    'description' => 'Export Nodes',
    'page callback' => 'data_export_import_callback_export_nodes',
    'access arguments' => array(
      'access data export import',
    ),
    'file' => 'includes/profiles/nodes.inc',
    'weight' => 1,
    'type' => MENU_LOCAL_TASK,
  );
  $items['admin/config/system/data_export_import/nodes/export'] = array(
    'title' => 'Export',
    'weight' => 2,
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['admin/config/system/data_export_import/nodes/import'] = array(
    'title' => 'Import',
    'description' => 'Import Nodes',
    'page callback' => 'data_export_import_callback_import_nodes',
    'access arguments' => array(
      'access data export import',
    ),
    'file' => 'includes/profiles/nodes.inc',
    'weight' => 3,
    'type' => MENU_LOCAL_TASK,
  );
  $items['admin/config/system/data_export_import/taxonomy_terms'] = array(
    'title' => 'Taxonomy terms',
    'description' => 'Export taxonomy terms',
    'page callback' => 'data_export_import_callback_export_taxonomy_terms',
    'access arguments' => array(
      'access data export import',
    ),
    'file' => 'includes/profiles/taxonomy_terms.inc',
    'weight' => 4,
    'type' => MENU_LOCAL_TASK,
  );
  $items['admin/config/system/data_export_import/taxonomy_terms/export'] = array(
    'title' => 'Export',
    'weight' => 5,
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['admin/config/system/data_export_import/taxonomy_terms/import'] = array(
    'title' => 'Import',
    'description' => 'Import taxonomy terms',
    'page callback' => 'data_export_import_callback_import_taxonomy_terms',
    'access arguments' => array(
      'access data export import',
    ),
    'file' => 'includes/profiles/taxonomy_terms.inc',
    'weight' => 6,
    'type' => MENU_LOCAL_TASK,
  );
  $items['admin/config/system/data_export_import/users'] = array(
    'title' => 'Users',
    'description' => 'Export Users',
    'page callback' => 'data_export_import_callback_export_users',
    'access arguments' => array(
      'access data export import',
    ),
    'file' => 'includes/profiles/users.inc',
    'weight' => 7,
    'type' => MENU_LOCAL_TASK,
  );
  $items['admin/config/system/data_export_import/users/export'] = array(
    'title' => 'Export',
    'weight' => 8,
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['admin/config/system/data_export_import/users/import'] = array(
    'title' => 'Import',
    'description' => 'Import Users',
    'page callback' => 'data_export_import_callback_import_users',
    'access arguments' => array(
      'access data export import',
    ),
    'file' => 'includes/profiles/users.inc',
    'weight' => 9,
    'type' => MENU_LOCAL_TASK,
  );
  return $items;
}

/**
 * Callback function for the overview tab.
 *
 * @return string
 *   Initial overview text and basic instructions.
 */
function data_export_import_callback_overview() {

  // This is a simple display of some instructions and warnings.
  return t("Please click on one of the profile tabs to export or import data.");
}

Functions

Namesort descending Description
data_export_import_callback_overview Callback function for the overview tab.
data_export_import_help Implements hook_help().
data_export_import_menu Implements hook_menu().
data_export_import_permission Implements hook_permission().