/** * Implementation of the pathauto_node hook * * @arg $op * the operation to perform -- currently 'placeholders' or 'values' * @arg $node * if called with $op='value', generate the placeholder values for $node * @return * returns the placeholder names or values for the given node */ function audio_pathauto_node($op, $node=null) { switch ($op) { case 'placeholders': $placeholders = array(); foreach (audio_get_tags_allowed() as $tag) { $placeholders[t('[audio' . $tag . ']')] = t('The ' . $tag . ' tag of the audio file.'); } return $placeholders; case 'values': $values = array(); foreach (audio_get_tags_allowed() as $tag) { $values[t('[audio' . $tag . ']')] = ''; } if ($node->type != 'audio') return $values; if (!$node->audio_tags) $node = node_load(array('nid' => $node->nid)); if (empty($node->audio_tags)) return $values; foreach (audio_get_tags_allowed() as $tag) { $values[t('[audio' . $tag . ']')] = pathauto_cleanstring($node->audio_tags[$tag]); } return $values; } }