Created
March 18, 2014 22:38
-
-
Save jhedstrom/9631346 to your computer and use it in GitHub Desktop.
A CTools content type plugin for the achievements module
This file contains hidden or 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 | |
/** | |
* @file | |
* Per-user badges/achievements CTools content type plugin. | |
*/ | |
/** | |
* The Achievements plugin definition. | |
*/ | |
$plugin = array( | |
'title' => t('Achievements by user'), | |
'category' => t('A sensible category'), | |
'description' => t('A user\'s earned badges.'), | |
'required context' => new ctools_context_required(t('User'), 'user'), | |
); | |
/** | |
* CTools content type output function. | |
*/ | |
function MYMODULE_achievements_content_type_render($subtype, $conf, $panels_args, $context) { | |
if (empty($context) || empty($context->data)) { | |
return; | |
} | |
// Build the custom content pane. | |
$pane = new stdClass(); | |
$pane->module = 'vista_'; | |
$pane->title = t('Badges'); | |
// Use the achievement module's user page. | |
module_load_include('inc', 'achievements', 'achievements.pages'); | |
$pane->content = achievements_user_page($context->data); | |
return $pane; | |
} | |
/** | |
* Pane admin form. | |
*/ | |
function MYMODULE_achievements_content_type_edit_form($form, &$form_state) { | |
// No additional config. | |
return $form; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment