You are here

function taxonomy_xml_create_guid_instance in Taxonomy import/export via XML 7

Create a field instance to attach to a vocab and store the URI in.

Uses field API CRUD

1 call to taxonomy_xml_create_guid_instance()
taxonomy_xml_prepare_vocabulary in ./taxonomy_xml.process.inc
Ensure a vocab will store our URI and extra values.

File

./taxonomy_xml.process.inc, line 114
The workhorse processes for importing taxonomies.

Code

function taxonomy_xml_create_guid_instance($vocab_name, $field_name = 'field_guid') {
  $instance = array(
    'field_name' => $field_name,
    'entity_type' => 'taxonomy_term',
    'label' => 'GUID',
    'bundle' => $vocab_name,
    'description' => 'Unique global identifier for this term. Usually an URL or URI, but need not be resolvable.',
    'required' => FALSE,
    'widget' => array(
      'type' => 'text_textfield',
      'module' => 'text',
      'settings' => array(
        'size' => 60,
      ),
      'weight' => -1,
    ),
    'display' => array(
      'full' => array(
        'label' => 'hidden',
        'type' => 'text_default',
        'settings' => array(),
        'weight' => -1,
      ),
    ),
  );
  return field_create_instance($instance);
}