Commit 80344cce authored by Matt Glaman's avatar Matt Glaman

Issue #2486097: The merchandising feature must not depend on the product feature

parent cec0b0f2
......@@ -497,6 +497,7 @@ function commerce_kickstart_install_finished(&$install_state) {
'commerce_kickstart_product' => array('commerce_autosku_patterns'),
// Fences has issues in Features
'commerce_kickstart_blog' => array('field_instance'),
'commerce_kickstart_merchandising' => array('field_instance'),
);
features_revert($feature_install_fix);
......
......@@ -289,3 +289,16 @@ function commerce_kickstart_rebuild_feature($module) {
}
_features_restore('rebuild', $items);
}
/**
* Implements hook_features_api_alter().
*
* Commerce Kickstart provides different Features that can be utilized
* individually, which means there are conflicting field bases. This allows
* the feature structure to exist, including customizations by users.
*/
function commerce_kickstart_features_api_alter(&$components) {
if (isset($components['field_base'])) {
$components['field_base']['duplicates'] = FEATURES_DUPLICATES_ALLOWED;
}
}
<?php
/**
* @file
* commerce_kickstart_merchandising.features.field_base.inc
*/
/**
* Implements hook_field_default_field_bases().
*/
function commerce_kickstart_merchandising_field_default_field_bases() {
$field_bases = array();
// Exported field_base: 'field_link'
$field_bases['field_link'] = array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_link',
'indexes' => array(),
'locked' => 0,
'module' => 'link',
'settings' => array(
'attributes' => array(
'target' => 'default',
),
'display' => array(
'url_cutoff' => '',
),
'enable_tokens' => 1,
'title' => 'optional',
'title_maxlength' => 128,
'title_value' => '',
'url' => 0,
),
'translatable' => 0,
'type' => 'link_field',
);
// Exported field_base: 'field_tagline'
$field_bases['field_tagline'] = array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_tagline',
'indexes' => array(
'format' => array(
0 => 'format',
),
),
'locked' => 0,
'module' => 'text',
'settings' => array(
'max_length' => 80,
),
'translatable' => 0,
'type' => 'text',
);
return $field_bases;
}
......@@ -4,8 +4,6 @@ core = 7.x
package = Commerce Kickstart
dependencies[] = block
dependencies[] = commerce_kickstart_migrate
dependencies[] = commerce_kickstart_product
dependencies[] = commerce_kickstart_slideshow
dependencies[] = ctools
dependencies[] = features
dependencies[] = image
......@@ -20,6 +18,8 @@ dependencies[] = views
features[ctools][] = strongarm:strongarm:1
features[ctools][] = views:views_default:3.0
features[features_api][] = api:2
features[field_base][] = field_link
features[field_base][] = field_tagline
features[field_instance][] = comment-comment_node_ad_push-comment_body
features[field_instance][] = node-ad_push-field_image
features[field_instance][] = node-ad_push-field_link
......
......@@ -20,3 +20,21 @@ function commerce_kickstart_merchandising_migrate_api() {
);
}
}
/**
* Implements hook_features_export_alter().
*
* Merchandising and Slidehow share the same fields, however they do not depend
* on one another. This is a Features 1.x -> 2.x gotcha. So we alter the export
* to remove/fix dependency and prevent the feature from appearing overridden in
* it's default state.
*/
function commerce_kickstart_merchandising_features_export_alter(&$export, $module_name) {
if ($module_name == 'commerce_kickstart_merchandising') {
if (isset($export['dependencies']['commerce_kickstart_slideshow'])) {
unset($export['dependencies']['commerce_kickstart_slideshow']);
}
$export['features']['field_base']['field_link'] = 'field_link';
$export['features']['field_base']['field_tagline'] = 'field_tagline';
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment