function fe_nodequeue_features_export_render in Features Extra 7
Implements hook_features_export_render().
@codingStandardsIgnoreStart
File
- fe_nodequeue/
fe_nodequeue.module, line 75 - Main functions and hook implementations of the FE Nodequeue module.
Code
function fe_nodequeue_features_export_render($module_name = '', $data) {
// @codingStandardsIgnoreEnd
$code = array();
$code[] = ' $nodequeues = array();';
$code[] = '';
$roles = user_roles();
foreach ($data as $name) {
// Clone the nodequeue object so that our changes aren't statically cached.
$nodequeue_static = _fe_nodequeue_load_queue_by_name($name, TRUE);
if (!empty($nodequeue_static) && ($nodequeue = clone $nodequeue_static)) {
// Sort roles and types arrays into ascending order so that we can check
// for overridden db data without being affected by the order in which
// this array gets stored/loaded.
if (!empty($nodequeue->roles)) {
// Roles that have the 'Manipulate all queues' permission will not get
// saved and will throw override messages as a result.
$manipulate_all_queues = array_keys(user_roles(FALSE, 'manipulate all queues'));
$nodequeue->roles = array_diff($nodequeue->roles, $manipulate_all_queues);
foreach ($nodequeue->roles as $index => $rid) {
$nodequeue->roles[$index] = $roles[$rid];
}
sort($nodequeue->roles);
}
if (!empty($nodequeue->types)) {
sort($nodequeue->types);
}
// Remove the nodequeue id. This is specific to the current site and
// should not be exported.
unset($nodequeue->qid);
// We don't care how many subqueues are in here since they get created
// automatically.
unset($nodequeue->subqueues);
$nodequeue_export = features_var_export($nodequeue, ' ');
$code[] = " // Exported nodequeues: {$nodequeue->name}.";
$code[] = " \$nodequeues['{$name}'] = {$nodequeue_export};";
$code[] = "";
}
}
$code[] = ' return $nodequeues;';
$code = implode("\n", $code);
return array(
'fe_nodequeue_export_fields' => $code,
);
}