You are here

function ccl_features_export_render in Custom Contextual Links 7

Same name and namespace in other branches
  1. 8 ccl.features.inc \ccl_features_export_render()

Implements hook_features_export_render().

File

./ccl.features.inc, line 46
Integrates Features for Custom Contextual Links.

Code

function ccl_features_export_render($module, $data) {
  $code = array();
  $presets = ccl_get_presets();
  foreach ($data as $title) {
    foreach ($presets as $preset) {
      $key = $preset->title . '||ID' . $preset->clid;
      if ($key == $title) {

        // We don't want to break the entity cache, so we need to clone the
        // presetting before unsetting the id.
        $preset = clone $preset;
        unset($preset->clid);
        $code[$key] = $preset;
      }
    }
  }
  $code = "  return " . features_var_export($code, '  ') . ";";
  return array(
    'ccl_features_preset' => $code,
  );
}