You are here

function custom_pub_features_enable_feature in Custom Publishing Options 7

Implements hook_features_enable_feature().

Parameters

$module: Name of module that has been enabled.

File

./custom_pub.features.inc, line 114
Adds support for the Features module.

Code

function custom_pub_features_enable_feature($module) {
  if ($default_options = features_get_default('custom_pub', $module)) {
    $spec = array(
      'type' => 'int',
      'not null' => TRUE,
      'default' => 0,
    );

    // Add fields in database
    foreach ($default_options as $option_name => $option_info) {
      if (!db_field_exists('node', $option_name)) {
        $spec['description'] = "Custom publishing option {$option_name}";
        db_add_field('node', $option_name, $spec);
      }
    }
    custom_pub_types_rebuild();

    // Rebuild schema
    cache_clear_all('schema', 'cache');
  }
}