You are here

function _spaces_taxonomy_term_save_preset_and_modifier in Spaces 7.3

Same name and namespace in other branches
  1. 7 spaces_taxonomy/spaces_taxonomy.module \_spaces_taxonomy_term_save_preset_and_modifier()

Save the Taxonomy Term preset values.

Parameters

$term: A term object.

2 calls to _spaces_taxonomy_term_save_preset_and_modifier()
spaces_taxonomy_taxonomy_term_insert in spaces_taxonomy/spaces_taxonomy.module
Implements hook_taxonomy_term_insert().
spaces_taxonomy_taxonomy_term_update in spaces_taxonomy/spaces_taxonomy.module
Implements hook_taxonomy_term_update().

File

spaces_taxonomy/spaces_taxonomy.module, line 227
spaces_taxonomy.module

Code

function _spaces_taxonomy_term_save_preset_and_modifier($term) {
  $spaces_taxonomy_machine_name = variable_get('spaces_taxonomy_machine_name', 0);
  if ($term->vocabulary_machine_name == $spaces_taxonomy_machine_name) {
    $space = spaces_load('taxonomy', $term->tid);
    if ($space) {

      // Save preset values.
      if (!empty($term->spaces_preset_taxonomy)) {
        $space->controllers->variable
          ->set('spaces_preset_taxonomy', $term->spaces_preset_taxonomy);
      }

      // Save PURL modifier.
      $modifier = array(
        'provider' => 'spaces_taxonomy',
        'id' => $term->tid,
        'value' => $term->purl['value'],
      );
      purl_save($modifier);
    }
  }
}