/[drupal]/contributions/modules/bio/bio_panels.inc
ViewVC logotype

Contents of /contributions/modules/bio/bio_panels.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Sat Apr 11 01:32:50 2009 UTC (7 months, 2 weeks ago) by vauxia
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +48 -0 lines
File MIME type: text/x-php
Adding bio_panels.inc and bio_views.inc from D5 branch
1 <?php
2 // $Id: bio_panels.inc,v 1.1.2.3 2008/01/25 07:33:54 webchick Exp $
3
4 /**
5 * @file
6 * Panels integration for Bio module.
7 */
8
9 /**
10 * Plugin to provide a relationship handler for node from user.
11 */
12 function bio_panels_relationships() {
13 $bio_type = bio_get_type();
14 $args['node_from_user'] = array(
15 'title' => t('User @type', array('@type' => $bio_type)),
16 'keyword' => 'node',
17 'description' => t("Adds a user's @type node.", array('@type' => $bio_type)),
18 'required context' => new panels_required_context(t('User'), 'user'),
19 'context' => 'bio_panels_context',
20 );
21
22 return $args;
23 }
24
25 /**
26 * Return a new context based on an existing context.
27 */
28 function bio_panels_context($context = NULL, $conf) {
29 // If unset it wants a generic, unfilled context, which is just NULL.
30 if (empty($context->data)) {
31 return panels_context_create_empty('node', NULL);
32 }
33
34 if (isset($context->data->uid)) {
35 // Load the NID for the user's bio node.
36 $nid = bio_for_user($context->data->uid);
37
38 // Load the node object itself.
39 $bionode = node_load(array('nid' => $nid));
40
41 // Send it to Panels.
42 return panels_context_create('node', $bionode);
43 }
44 else {
45 return panels_context_create_empty('node', NULL);
46 }
47 }
48

  ViewVC Help
Powered by ViewVC 1.1.2