Last updated August 1, 2012. Created by nedjo on October 7, 2011.
Log in to edit this page.

Often a feature will be based around a particular type of content, like a blog post or an event.

Fields

Fields commonly used in Debut feature content types include:

  • Content image: Most Debut content types use an image field, field_content_image, for images associated with content.
  • Tags: Most Debut content types use a freetagging taxonomy field, field_tags. See special discussion of the Tags vocabulary in the page on Debut and taxonomy.

To add these fields to a new Debut feature:

  • Create the new content type.
  • Add one or more of these existing fields to the content type.
  • When generating or regenerating the feature, add the content type and its fields.

Special handling for field_content_image

Two custom display enhancements are used with field_content_image:

  • Add .css to add image border and float. Sample CSS file (from Debut Article):

    .node-article.node-teaser .field-name-field-content-image img {
      float: right;
      margin-left: 15px;
      margin-bottom: 15px;
      border: 1px solid #C0C0C0;
    }
    .node-article .field-type-image {
      clear: both;
      float: right;
      margin-left: 12px;
      margin-bottom: 12px;
    }

    Sample hook_init() implementation to add the css:

    <?php
    /**
    * Implements hook_init().
    */
    function debut_article_init() {
     
    drupal_add_css(drupal_get_path('module', 'debut_article') . '/debut_article.css');
    }
    ?>
  • Debut Media includes an image style suitable for displaying floated images in a full node context. However, we can't directly use that image style without creating a dependency on Debut Media. Instead, use the default Drupal core 'large' image style. Then, in your .module file, switch out the large image style for the 'medium_large' one supplied by Debut Media:

    <?php
    /**
    * Implements hook_field_default_fields_alter().
    *
    * If debut_media module is present, use an image style it provides instead of
    * the default 'large' style.
    */
    function debut_article_field_default_fields_alter(&$fields) {
      if (isset(
    $fields['node-article-field_content_image']) && module_exists('debut_media') && !debut_article_is_recreating('debut_article')) {
       
    $fields['node-article-field_content_image']['field_instance']['display']['default']['settings']['image_style'] = 'medium_large';
      }
    }
    ?>

Media fields

Because they include a lot of configuration, Media fields (field_media, for video, audio, etc.) are handled in a special way. Rather than being added individually to each feature, they are handled by the Debut MediaDebut Media module. To have your Debut feature's content type receive a media field, include the following in the .info file:

debut[media][node_types][mytype] = mytype

where mytype is the machine name of the content type.

Specific Debut integration

Social media

To have your Debut feature's content type receive social media links if Debut Social is enabled, include the following in the .info file:

debut[media][node_types][mytype] = mytype

where mytype is the machine name of the content type.

Comments

The anonymous commenting setting (comment_anonymous_[nodetype]) should be set to 1, "Anonymous posters may leave their contact information", for compatibility with Debut Comment's use of comment notifications.

Views and local action

Every content type should have a landing page at /mytype where mytype is the machine name of the content type. When on that page, we add a local action (an action link) so that users with appropriate permissions will be able to add content of the given type.

Example from Debut Article:

<?php
/**
* Implements hook_menu_local_tasks_alter().
*
* Add an action link to 'node/add/article' on 'article' page.
*/
function debut_article_menu_local_tasks_alter(&$data, $router_item, $root_path) {
  if (
$root_path == 'article') {
   
$item = menu_get_item('node/add/article');
    if (
$item['access']) {
     
$data['actions']['output'][] = array(
       
'#theme' => 'menu_local_action',
       
'#link' => $item,
      );
    }
  }
}
?>

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.