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
Comment #1
ezra-g commentedComment #2
ezra-g commentedThere'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.
Comment #3
ezra-g commentedCorrection to the info file.
Comment #4
ezra-g commentedNow with less dpm().
Comment #5
ezra-g commentedThe previous patches were missing the new field instance definition.
Comment #6
charlie charles commentedSorry, 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
Comment #7
ezra-g commented#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.