Download & Extend

Implement hook_content_extra_fields()

Project:Smackdown
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (won't fix)

Issue Summary

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

Comments

#1

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.

#2

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().
  */

#3

Status:active» needs review

Heres a patch.

AttachmentSize
smackdown_content_extra_fields.patch 878 bytes

#4

Subscribing, greetings, Martijn

#5

Status:needs review» closed (won't fix)
nobody click here