Created
June 26, 2012 13:27
-
-
Save derhasi/2995778 to your computer and use it in GitHub Desktop.
A purl implementation for Drupal.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_purl_provider(). | |
*/ | |
function zppurl_purl_provider() { | |
return array( | |
'zp_meisterschaft' => array( | |
'name' => t('Meisterschaft provider'), | |
'description' => t('Retrieves ID for the current meisterschaft.'), | |
'callback' => 'drupal_set_message', | |
'example' => 'foobar', | |
), | |
); | |
} | |
/** | |
* Implements hook_purl_modifiers(). | |
*/ | |
function zppurl_purl_modifiers() { | |
// Load possible | |
$options = array( | |
'title_field' => 'name', | |
'ids' => array(), | |
'string' => '', | |
'match' => '', | |
); | |
$ids = references_potential_references_view('taxonomy_term', 'zppurl_helper', 'references_1', array(), $options); | |
$modifiers = array(); | |
foreach ($ids as $id => $spec) { | |
$key = strip_tags($spec['rendered']); | |
if (!empty($key)) { | |
$modifiers[] = array('value' => $key, 'id' => $id); | |
} | |
} | |
return array( | |
'zp_meisterschaft' => $modifiers, | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment