You are here

function ckeditor_profile_features_export_render in CKEditor - WYSIWYG HTML editor 6

Same name and namespace in other branches
  1. 7 includes/ckeditor.features.inc \ckeditor_profile_features_export_render()

Implementation of hook_features_export_render()

File

includes/ckeditor.features.inc, line 71
CKEditor - The text editor for the Internet - http://ckeditor.com Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.

Code

function ckeditor_profile_features_export_render($module_name, $data) {
  $profiles = array();
  $roles = user_roles();
  foreach ($data as $name) {
    $profile = (array) ckeditor_profile_load($name);

    // Convert Role IDs into role names only
    $roles = array_values((array) $profile['rids']);
    if (empty($roles)) {
      $profile['roles'] = array();
    }
    else {
      $profile['roles'] = array_combine($roles, $roles);
    }
    unset($profile['rids']);
    $profiles[$name] = $profile;
  }
  $code = '  $data = ' . features_var_export($profiles, '  ') . ';' . PHP_EOL;
  $code .= '  return $data;';
  return array(
    'ckeditor_profile_defaults' => $code,
  );
}