user_from_node.inc
Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008 function panels_user_from_node_panels_relationships() {
00009 $args['user_from_node'] = array(
00010 'title' => t("User from node"),
00011 'keyword' => 'user',
00012 'description' => t('Adds a user from node author context'),
00013 'required context' => new panels_required_context(t('Node'), 'node'),
00014 'context' => 'panels_user_from_node_context',
00015 );
00016 return $args;
00017 }
00018
00019
00020
00021
00022 function panels_user_from_node_context($context = NULL, $conf) {
00023
00024 if (empty($context->data)) {
00025 return panels_context_create_empty('user', NULL);
00026 }
00027 if (isset($context->data->uid)) {
00028
00029 $uid = $context->data->uid;
00030 $account = user_load(array('uid' => $uid));
00031
00032
00033 return panels_context_create('user', $account);
00034 }
00035 else {
00036 return panels_context_create_empty('user', NULL);
00037 }
00038 }
00039