function uuid_user_features_export_render in UUID Features Integration 7
Implements hook_features_export_render().
File
- includes/
uuid_user.features.inc, line 61 - Features hooks for the user features component.
Code
function uuid_user_features_export_render($module, $data) {
$translatables = $code = array();
$code[] = ' $users = array();';
$code[] = '';
$uids = entity_get_id_by_uuid('user', $data);
// Always sort by the uuid to ensure the order is maintained.
ksort($uids);
foreach ($uids as $uuid => $uid) {
// Only export the user if it exists.
if ($uid === FALSE) {
continue;
}
// Attempt to load the user, using a fresh cache.
$account = user_load($uid, TRUE);
if (empty($account)) {
continue;
}
// Clone entity to avoid changes by reference.
$export = clone $account;
// Use date instead of created - same format used by node_object_prepare.
$export->date = format_date($export->created, 'custom', 'Y-m-d H:i:s O');
unset($export->uid, $export->pass, $export->access, $export->login);
$entity_type = 'user';
drupal_alter('uuid_entity_features_export_render', $entity_type, $export, $account, $module);
drupal_alter('uuid_user_features_export_render', $export, $account, $module);
$code[] = ' $users[] = ' . features_var_export($export) . ';';
}
if (!empty($translatables)) {
$code[] = features_translatables_export($translatables, ' ');
}
$code[] = ' return $users;';
$code = implode("\n", $code);
return array(
'uuid_features_default_users' => $code,
);
}