hook_def

Definition

hook_def()
importexportapi/docs/developer/hooks/importexportapi.php, line 25

Description

Declare the data definition of one or more entities and its child fields.

Return value

An array keyed by entity field name. Each element of the array is a nested data definition.

Related topics

Namesort iconDescription
HooksAllow modules to interact with the Drupal core.

Code

<?php
function hook_def() {
  $defs = array();

  $def = array(
    '#type' => 'entity',
    '#title' => t('URL alias'),
    '#xml_plural' => 'url-aliases',
    '#csv_plural' => 'url-aliases'
  );

  $def['pid'] = array(
    '#type' => 'int',
    '#title' => t('URL alias ID'),
    '#key' => TRUE
  );
  $def['src'] = array(
    '#title' => t('System path'),
    '#xml_mapping' => 'system-path',
    '#csv_mapping' => 'system-path'
  );
  $def['dst'] = array(
    '#title' => t('Aliased path'),
    '#xml_mapping' => 'aliased-path',
    '#csv_mapping' => 'aliased-path',
    '#unique' => TRUE
  );

  $defs['url_alias'] = $def;

  return $defs;
}
?>