You are here

function spaces_taxonomy_taxonomy in Spaces 6.3

Implementation of hook_taxonomy().

File

spaces_taxonomy/spaces_taxonomy.module, line 149

Code

function spaces_taxonomy_taxonomy($op, $type, $array = NULL) {
  if ($type === 'term') {
    $term = $array;
    switch ($op) {
      case 'insert':
      case 'update':
        $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);
        }
        break;
      case 'delete':
        spaces_delete('taxonomy', $term['tid']);
        $modifier = array(
          'provider' => 'spaces_taxonomy',
          'id' => $term['tid'],
        );
        purl_delete($modifier);
        break;
    }
  }
}