From 8aaf8d8c1e20636f48561123e44c7c0b3cd23a42 Mon Sep 17 00:00:00 2001
From: Cristina Hanes <chanes@Cristinas-iMac.local>
Date: Fri, 24 Aug 2012 17:04:45 -0700
Subject: [PATCH] Issue #1751806 by cristinawithout: Implement display suite
 field hooks

---
 exclude_node_title.module |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/exclude_node_title.module b/exclude_node_title.module
index 5279cee..80a80bf 100755
--- a/exclude_node_title.module
+++ b/exclude_node_title.module
@@ -195,6 +195,33 @@ function exclude_node_title_field_attach_delete_bundle($entity_type, $bundle, $i
 }
 
 /**
+ * Implements hook_ds_fields_info_alter()
+ */
+function exclude_node_title_ds_fields_info_alter(&$fields, $entity_type) {
+  if ($entity_type == 'node') {
+    $fields['title']['function'] = '_exclude_node_title_ds_render_field';
+    $fields['title']['properties']['settings']['exclude node title settings'] = array(
+      'type' => 'select', 
+      'options' => array('No', 'Yes'),
+      'description' => t('Use the settings for the Exclude Node Title module for the title. Set to "off" to always show title.'),
+    );
+    $fields['title']['properties']['default']['exclude node title settings'] = 1;
+  }
+}
+
+/*
+ * Render the field obeying exclude node title settings
+ */
+function _exclude_node_title_ds_render_field($field) {
+  $settings = isset($field['formatter_settings']) ? $field['formatter_settings'] : array();
+  $settings += $field['properties']['default'];
+  if ($settings['exclude node title settings'] && _exclude_node_title($field['entity']->nid, $field['view_mode'])) {
+    $field['entity']->title = '';
+  }
+  return ds_render_field($field);
+}
+
+/**
  * Tells if node should get hidden or not.
  * @param $param
  *   Can be a node object or integer value (nid)
-- 
1.7.5.4

