You are here

function block_class_features_export_render in Block Class 7

Implements hook_features_export_render().

File

./block_class.features.inc, line 39
Integration with the Features module API.

Code

function block_class_features_export_render($module, $data) {
  $query = db_select('block_class', 'bc');
  $query
    ->addExpression("CONCAT(bc.module, ':', bc.delta)", 'id');
  $query
    ->addField('bc', 'css_class');
  $classes = $query
    ->execute()
    ->fetchAllKeyed(1, 0);
  $code = array();
  foreach ($data as $id) {
    if (isset($classes[$id])) {
      list($module, $delta) = explode(':', $id);
      $css_classes = $classes[$id];
      $code[$id] = compact('module', 'delta', 'css_classes');
    }
  }
  $code = "  return " . features_var_export($code, '  ') . ";";
  return array(
    'block_class_features_default_class' => $code,
  );
}