You are here

commerce_kickstart_merchandising.module in Commerce Kickstart 7.2

File

modules/commerce_kickstart/commerce_kickstart_merchandising/commerce_kickstart_merchandising.module
View source
<?php

/**
 * @file
 * Code for the Commerce Kickstart Merchandising feature.
 */
include_once 'commerce_kickstart_merchandising.features.inc';

/**
 * Implements hook_migrate_api().
 */
function commerce_kickstart_merchandising_migrate_api() {

  // Only register the migration for demo store.
  if (variable_get('commerce_kickstart_demo_store', FALSE)) {
    return array(
      'api' => 2,
      'migrations' => array(
        'CommerceKickstartAdPush' => array(
          'class_name' => 'CommerceKickstartAdPush',
        ),
      ),
    );
  }

  // Return a near empty array to avoid API warning.
  // @link https://www.drupal.org/node/2544320
  return array(
    'api' => 2,
  );
}

/**
 * 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';
  }
}