Use hook_content_extra_fields() for the voting results. So they can be moved around properly

Comments

sirkitree’s picture

So, we can go ahead and implement this, but by default, smackdown doesn't output the result on the node. It's its own tab. So this won't really do us any good unless there is first a way that this is being added to the $node['content'] first.

sirkitree’s picture

But just for the record, here is how you do it (♬ this is how we do it - sha la la la la la ♬)

Index: smackdown.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/smackdown/smackdown.module,v
retrieving revision 1.1.2.5.2.19
diff -u -p -r1.1.2.5.2.19 smackdown.module
--- smackdown.module	23 Oct 2009 17:30:55 -0000	1.1.2.5.2.19
+++ smackdown.module	4 Nov 2009 21:12:48 -0000
@@ -360,6 +360,26 @@ function smackdown_field_formatter_info(
 }
 
 /**
+ * Implementation of hook_content_extra_fields().
+ *
+ * Informations for non-CCK 'node fields' defined in core.
+ */
+function smackdown_content_extra_fields($type_name) {
+  $type = node_get_types('type', $type_name);
+  $types = variable_get('smackdown_types', array());
+  $extra = array();
+
+  if (in_array($type->name, $types)) {
+    $extra['smackdown'] = array(
+      'label' => t('Smackdown results'),
+      'description' => t('Smackdown results.'),
+      'weight' => 0
+    );
+  }
+  return $extra;
+}
+
+/**
  * Theme function for 'smackdown' nodereference field formatter.
  * Copied from nodereference's theme_nodereference_formatter_full_teaser().
  */

Scott Reynolds’s picture

Status: Active » Needs review
StatusFileSize
new878 bytes

Heres a patch.

summit’s picture

Subscribing, greetings, Martijn

sirkitree’s picture

Status: Needs review » Closed (won't fix)