/** * 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': return array(t('[audioalbum]') => t('The album name of the audio file.'), t('[audioartist]') => t('The artist name of the audio file.'), t('[audiogenre]') => t('The genre of the audio file.'), t('[audiotitle]') => t('The title of the audio file.'), t('[audiotrack]') => t('The track number of the audio file.'), t('[audioyear]') => t('The year of the audio file.')); case 'values': { $empty = array(t('[audioalbum]') => '', t('[audioartist]') => '', t('[audiogenre]') => '', t('[audiotitle]') => '', t('[audiotrack]') => '', t('[audioyear]') => ''); if ($node->type != 'audio') return $empty; if (!$node->audio) $node = node_load(array('nid' => $node->nid)); if (empty($node->audio)) return $empty; return array(t('[audioalbum]') => pathauto_cleanstring($node->audio['album']), t('[audioartist]') => pathauto_cleanstring($node->audio['artist']), t('[audiogenre]') => pathauto_cleanstring($node->audio['genre']), t('[audiotitle]') => pathauto_cleanstring($node->audio['title']), t('[audiotrack]') => pathauto_cleanstring($node->audio['track']), t('[audioyear]') => pathauto_cleanstring($node->audio['year'])); } } }