Mercurial > hg > rr-repo
annotate sites/all/modules/ctools/plugins/relationships/user_from_node.inc @ 9:830c812b520f
added smtp module
author | root <root@paio.local> |
---|---|
date | Mon, 28 Oct 2013 15:34:27 +0000 |
parents | ff03f76ab3fe |
children |
rev | line source |
---|---|
danielebarchiesi@0 | 1 <?php |
danielebarchiesi@0 | 2 |
danielebarchiesi@0 | 3 /** |
danielebarchiesi@0 | 4 * @file |
danielebarchiesi@0 | 5 * Plugin to provide an relationship handler for node from user. |
danielebarchiesi@0 | 6 */ |
danielebarchiesi@0 | 7 |
danielebarchiesi@0 | 8 /** |
danielebarchiesi@0 | 9 * Plugins are described by creating a $plugin array which will be used |
danielebarchiesi@0 | 10 * by the system that includes this file. |
danielebarchiesi@0 | 11 */ |
danielebarchiesi@0 | 12 $plugin = array( |
danielebarchiesi@0 | 13 'title' => t('Node author'), |
danielebarchiesi@0 | 14 'keyword' => 'user', |
danielebarchiesi@0 | 15 'description' => t('Creates the author of a node as a user context.'), |
danielebarchiesi@0 | 16 'required context' => new ctools_context_required(t('Node'), 'node'), |
danielebarchiesi@0 | 17 'context' => 'ctools_user_from_node_context', |
danielebarchiesi@0 | 18 'no ui' => TRUE, |
danielebarchiesi@0 | 19 ); |
danielebarchiesi@0 | 20 |
danielebarchiesi@0 | 21 /** |
danielebarchiesi@0 | 22 * Return a new context based on an existing context. |
danielebarchiesi@0 | 23 */ |
danielebarchiesi@0 | 24 function ctools_user_from_node_context($context, $conf) { |
danielebarchiesi@0 | 25 // If unset it wants a generic, unfilled context, which is just NULL. |
danielebarchiesi@0 | 26 if (empty($context->data) || !isset($context->data->uid)) { |
danielebarchiesi@0 | 27 return ctools_context_create_empty('user', NULL); |
danielebarchiesi@0 | 28 } |
danielebarchiesi@0 | 29 |
danielebarchiesi@0 | 30 if (isset($context->data->uid)) { |
danielebarchiesi@0 | 31 // Load the user that is the author of the node. |
danielebarchiesi@0 | 32 $uid = $context->data->uid; |
danielebarchiesi@0 | 33 $account = user_load($uid); |
danielebarchiesi@0 | 34 |
danielebarchiesi@0 | 35 // Send it to ctools. |
danielebarchiesi@0 | 36 return ctools_context_create('user', $account); |
danielebarchiesi@0 | 37 } |
danielebarchiesi@0 | 38 } |