summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVesa Palmu2010-11-07 12:18:21 (GMT)
committer Vesa Palmu2010-11-07 12:18:21 (GMT)
commit6d874a0d665b7f1c49ee897c160d343084dc19f2 (patch)
tree4c22ad72a0aa8b11fa8ccac7bd1817d666590e81
parentc1222bf4fb3ee5b1fae2f9104974330377f836ae (diff)
#806478 by swentel: AddThis integration with Display Suite6.x-2.10
-rw-r--r--addthis.module31
1 files changed, 31 insertions, 0 deletions
diff --git a/addthis.module b/addthis.module
index d82361c..10f130d 100644
--- a/addthis.module
+++ b/addthis.module
@@ -106,6 +106,37 @@ function addthis_views_api() {
}
/**
+ * Implementation of hook_ds_fields().
+ */
+function addthis_ds_fields($type_name, $build_mode, $extra) {
+ if (variable_get('addthis_nodetype_' . $type_name, 1)) {
+ return array(
+ 'nd' => array(
+ 'addthis' => array(
+ 'title' => t('AddThis'),
+ 'type' => DS_FIELD_TYPE_FUNCTION,
+ 'status' => DS_FIELD_STATUS_STATIC,
+ 'properties' => array(
+ 'formatters' => array(
+ '_addthis_ds_create_button' => t('AddThis'),
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}
+
+/**
+ * Internal function for Display Suite to return the code for AddThis button.
+ */
+function _addthis_ds_create_button($field) {
+ if (isset($field['object'])) {
+ return _addthis_create_button($field['object'], TRUE);
+ }
+}
+
+/**
* Internal function to generate code for AddThis button
*
* @return