You are here

function fe_nodequeue_features_export in Features Extra 7

Implements hook_features_export().

File

fe_nodequeue/fe_nodequeue.module, line 38
Main functions and hook implementations of the FE Nodequeue module.

Code

function fe_nodequeue_features_export($data, &$export, $module_name = '') {
  $pipe = array();
  $map = features_get_default_map('fe_nodequeue');
  foreach ($data as $name) {
    $export['dependencies']['fe_nodequeue'] = 'fe_nodequeue';

    // If another module provides this style, add it as a dependency.
    if (isset($map[$name]) && $map[$name] != $module_name) {
      $module = $map[$name];
      $export['dependencies'][$module] = $module;
    }
    elseif ($queue = _fe_nodequeue_load_queue_by_name($name, TRUE)) {

      // Add dependencies for the roles that are associated with these queues.
      if ($queue->roles) {

        // Filter out roles that have the 'manipulate all queues' permission.
        // @see http://drupal.org/node/213074
        $manipulate_all_queues = array_keys(user_roles(FALSE, 'manipulate all queues'));
        $queue->roles = array_diff($queue->roles, $manipulate_all_queues);
        $roles = user_roles();
        foreach ($queue->roles as $index => $rid) {
          $export['features']['user_role'][$roles[$rid]] = $roles[$rid];

          // Convert the role from a rid to a 'machine name' for saving. This
          // will be converted back to a rid when the feature is reverted.
          $queue->roles[$index] = $roles[$rid];
        }
      }
      $export['features']['fe_nodequeue'][$name] = $name;
    }
  }
  return $pipe;
}