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

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

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

revision 1.1, Fri Jan 18 06:02:16 2008 UTC revision 1.2, Sat Apr 11 01:32:50 2009 UTC
# Line 0  Line 1 
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    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.2