You are here

function themekey_features_rule_chain_features_export_render in ThemeKey 7

Same name and namespace in other branches
  1. 6.4 themekey_features.module \themekey_features_rule_chain_features_export_render()
  2. 6.3 themekey_features.module \themekey_features_rule_chain_features_export_render()
  3. 7.3 themekey_features.module \themekey_features_rule_chain_features_export_render()
  4. 7.2 themekey_features.module \themekey_features_rule_chain_features_export_render()

Implements hook_features_export_render().

File

./themekey_features.module, line 52

Code

function themekey_features_rule_chain_features_export_render($module_name, $data, $export = NULL) {
  $rules = themekey_features_load_rule_childs();
  $keep_rules = array();
  foreach ($rules as $rule) {
    if (in_array(md5(serialize($rule)), $data)) {
      $keep_rules[] = $rule;
    }
  }
  $code = array();
  $code[] = "if (!defined('THEMEKEY_PAGECACHE_UNSUPPORTED')) {\n    define('THEMEKEY_PAGECACHE_UNSUPPORTED', 0);\n    define('THEMEKEY_PAGECACHE_SUPPORTED', 1);\n    define('THEMEKEY_PAGECACHE_TIMEBASED', 2);\n  }";
  $code[] = '$rules = ' . features_var_export($keep_rules) . ';';
  $code[] = '';
  $code[] = 'return $rules;';
  return array(
    'themekey_features_rule_chain_import' => implode("\n", $code),
  );
}