From 3b83a67933707f41ba03b763a1728aa4afd6176f Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 23 Sep 2011 16:31:58 -0300 Subject: Setting widget --- muamba.module | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'muamba.module') diff --git a/muamba.module b/muamba.module index 4c7c4b8..96882d6 100644 --- a/muamba.module +++ b/muamba.module @@ -34,23 +34,39 @@ function muamba_menu() { /** * Implements hook_node_view() + * + * @todo + * Check widget status + * Check permissions */ function muamba_node_view($node, $view_mode, $langcode) { + global $user; + /* - *$node->content['my_additional_field'] = array( - * '#markup' => $additional_field, - * '#weight' => 10, - * '#theme' => 'mymodule_my_additional_field', - *); + // Do not show widget to the owner + if ($node->uid == $user->uid) { + return; + } */ - global $user; if ($view_mode == 'full') { $node->content['muamba'] = array( - '#markup' => 'Request item.', + '#markup' => theme('muamba_widget', array('nid' => $node->nid)), '#weight' => 100, - ); + ); return $node; } } + +/** + * Implements hook_theme() + */ +function muamba_theme($existing, $type, $theme, $path) { + return array( + 'muamba_widget' => array( + 'template' => 'muamba-widget', + 'variables' => array('nid' => NULL), + ), + ); +} -- cgit v1.2.3