Skip to content

Instantly share code, notes, and snippets.

@iAugur
Created November 16, 2012 10:55
Show Gist options
  • Save iAugur/4086397 to your computer and use it in GitHub Desktop.
Save iAugur/4086397 to your computer and use it in GitHub Desktop.
Drupal: Surface a block as a Display Suite Field
/**
* Create a custom module and implement hook_ds_fields_info to surface your 'field' to DS
* Create a custom theme function to create the content when called by DS
*
*
*/
function yourmodule_ds_fields_info($entity_type) {
$fields = array(
'yourmodule_group' => array(
'title' => t('some desc Group'),
'field_type' => DS_FIELD_TYPE_THEME,
'properties' => array(
'formatters' => array(
'yourmodule_block' => t('Text'),
),
),
),
);
return array('node' => $fields);
}
function theme_yourmodule_block($variables) {
// do some fancy stuff here
$content = 'your field contents to return';
return $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment