Created
September 22, 2009 22:06
-
-
Save msonnabaum/191474 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Implementation of hook_ctools_context_convert_list(). | |
*/ | |
function misc_ctools_context_convert_list($plugin, &$converters) { | |
if ($plugin['name'] == 'node') { | |
$converters = $converters + array('field_firstname' => t('First Name'), 'field_lastname' => t('Last Name')); | |
} | |
return $converters; | |
} | |
/** | |
* Implementation of hook_ctools_context_converter_alter(). | |
*/ | |
function misc_ctools_context_converter_alter($context, $converter, &$value) { | |
// Make sure we have a node to extract fields data from. | |
if ($context->type != 'node' || empty($context->data)) { | |
return; | |
} | |
$node = $context->data; | |
$value = $node->{$converter}[0]['value']; | |
return $value; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment