You are here

function taxonomy_patterns_export_all_terms in Patterns 7.2

Same name and namespace in other branches
  1. 7 patterns_components/components/taxonomy.inc \taxonomy_patterns_export_all_terms()
1 string reference to 'taxonomy_patterns_export_all_terms'
taxonomy_patterns in patterns_components/components/taxonomy.inc

File

patterns_components/components/taxonomy.inc, line 71
Patterns component for taxonomy vocabularies and terms.

Code

function taxonomy_patterns_export_all_terms($args = NULL, $result = NULL) {
  $action_type = PATTERNS_MODIFY;

  // pre-init
  if (isset($args['type'])) {
    if ($args['type'] == PATTERNS_CREATE) {
      $action_type = PATTERNS_CREATE;
    }

    // other action types
  }
  $info = taxonomy_patterns();
  $terms = entity_load('taxonomy_term');
  $form_id = current($info['term'][PATTERNS_MODIFY]);
  $result = array();
  foreach ($terms as $term) {

    // It is important to user array merge. Pushing is not enough
    $result = array_merge($result, patterns_export_actions_from_form($form_id, $term, 'term', $action_type));
  }
  return $result;
}