You are here

function block_access_features_export_render in Block Access 7

Implements hook_features_export_render().

File

./block_access.module, line 717

Code

function block_access_features_export_render($module_name = '', $data, $export = NULL) {
  $code = array();
  $code[] = '  $block_access = array();';
  $code[] = '';
  foreach ($data as $module => $perms) {
    module_load_include('inc', 'block_access', 'block_access.db');
    if (!is_array($perms)) {
      module_load_include('inc', 'block_access', 'block_access.db');
      $module = $perms;
      $perms = block_access_get_module($module);
      $roles = user_roles();
      foreach (array_keys($perms) as $role) {
        $perms[$roles[$role]] = $perms[$role];
        unset($perms[$role]);
      }
    }
    $block_access_export = features_var_export($perms, '  ');
    $code[] = "  // Exported Block Access settings for module {$module}";
    $code[] = "  \$block_access['{$module}'] = {$block_access_export};";
    $code[] = "";
  }
  $code[] = '  return $block_access;';
  $code = implode("\n", $code);
  return array(
    'block_access_defaults' => $code,
  );
}