Closed (fixed)
Project:
Content Profile
Version:
6.x-1.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
22 Dec 2008 at 15:59 UTC
Updated:
28 Sep 2010 at 21:00 UTC
I took the relationship code I wrote for nodeprofile and updated it to work with content profile. It's only had minimal testing but seems to be working fine so far. If you could get this commited soon, I'd appreciate it. I'm trying to get something usable going for APK in D6 and the less patching users have to do to other modules the better.
/**
* Plugin to provide an relationship handler for node from user
*/
function content_profile_panels_relationships() {
$args['node_from_user'] = array(
'title' => t("Profile node from user"),
'keyword' => 'profile_node',
'description' => t('Adds a profile node from user context'),
'required context' => new panels_required_context(t('User'), 'user'),
'context' => 'content_profile_panels_context',
'settings form' => 'content_profile_panels_settings_form',
);
return $args;
}
/**
* Return a new context based on an existing context
*/
function content_profile_panels_context($context = NULL, $conf) {
// If unset it wants a generic, unfilled context, which is just NULL
if (empty($context->data)) {
return panels_context_create_empty('node', NULL);
}
if (isset($context->data->uid)) {
// Load the node for the requested type
$uid = $context->data->uid;
$content_profile_node = content_profile_load($conf['type'], $uid);
// Send it to panels
return panels_context_create('node', $content_profile_node);
}
else {
return panels_context_create_empty('node', NULL);
}
}
/**
* Settings form for the relationship
*/
function content_profile_panels_settings_form($conf) {
$options = content_profile_get_types('names');
$form['type'] = array(
'#type' => 'select',
'#title' => t('Relationship type'),
'#options' => $options,
'#default_value' => $conf['type']
);
return $form;
}
Thanks,
Michelle
Comments
Comment #1
michelleAny thoughts on this? I know it's the holidays, but I'm really trying to push APK for D6 out and this is a major stumbling block...
Michelle
Comment #2
somenoise commentedI will love to see this commited :)
Comment #3
fagoHave you seen this issue? http://drupal.org/node/322782
As the code looks like being the same, I've just committed it. Please test..
Comment #4
michelleNo, I hadn't until you pinged me on IRC. Luckily I didn't spend too much time on it. Doh!
I'll give it a whirl in a bit if the kids stay behaving.
Michelle
Comment #6
1kenthomas commentedWait, is this not committed?
Comment #7
michelleYes, this was committed nearly 2 years ago.
Michelle