Motivation: A site with multiple custom content types that integrate into the browsing widget. Some of those content types should include the title field in the browsing widget while others should not.

Problem: Commons BW module defines instances of the title field on behalf of all node types. This makes it impossible to export the title field after the initial export. The export includes a hard-coded value for 'the display_in_partial_form' field.

/**
 * Creates field instance definitions for all node types.
 */
function commons_bw_field_definition(&$field_instances, $bundle) {
  // Define which of the bundles should display the title field in the partial
  // node form.
  $display_in_partial_form = array(
    'wiki' => TRUE,
  );

  // Exported field_instance: 'node-[Bundle]-title_field'
  $field_instances["node-$bundle-title_field"] = array(
    'bundle' => $bundle,
    'default_value' => NULL,
    'deleted' => '0',
    'description' => '',
    'display' => array(
      'default' => array(
        'label' => 'above',
        'settings' => array(),
        'type' => 'hidden',
        'weight' => 12,
      ),
      'teaser' => array(
        'label' => 'above',
        'settings' => array(),
        'type' => 'hidden',
        'weight' => 0,
      ),
    ),
    'display_in_partial_form' => !empty($display_in_partial_form[$bundle]),

Comments

ezra-g’s picture

Assigned: Unassigned » ezra-g
ezra-g’s picture

Status: Active » Needs review
StatusFileSize
new6.87 KB

There's a place in Commons where we indicate changes to configuration that Commons does on behalf of modules that own an entity type:
hook_commons_entity_integration().

This patch implements a new 'auto_title_instance' parameter. When TRUE, Commons_BW will not define a title field instance on behalf of this content type.

I've implemented this for Commons Wikis and included a new title field export.

ezra-g’s picture

StatusFileSize
new6.96 KB

Correction to the info file.

ezra-g’s picture

StatusFileSize
new6.91 KB

Now with less dpm().

ezra-g’s picture

StatusFileSize
new8.17 KB

The previous patches were missing the new field instance definition.

charlie charles’s picture

Sorry, for the newbie question
I want to replace the Wikis with my
own content type I've made

Will this patch do this?

Many Thanks for your help

ezra-g’s picture

Status: Needs review » Fixed

#5 is committed: http://drupalcode.org/project/commons.git/commit/744c19d .

@charlie charles - The present issue is unrelated to that. See #1782922: Document pattern for creating Commons-compatible group content type features for more information about integrating custom content types with Drupal Commons.

Automatically closed -- issue fixed for 2 weeks with no activity.