Skip to content

Instantly share code, notes, and snippets.

@derhasi
Created June 26, 2012 13:27
Show Gist options
  • Save derhasi/2995778 to your computer and use it in GitHub Desktop.
Save derhasi/2995778 to your computer and use it in GitHub Desktop.
A purl implementation for Drupal.
<?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