function access_scheme_features_export in Access Control Kit 7
Implements hook_features_export().
File
- ./
access.features.inc, line 11 - Features integration for the access control kit module.
Code
function access_scheme_features_export($data, &$export, $module_name = '') {
$pipe = array();
$export['dependencies']['features'] = 'features';
$export['dependencies']['access'] = 'access';
// Add each selected scheme and its dependencies.
$handler_info = access_handler_info();
foreach ($data as $scheme_machine_name) {
$scheme = access_scheme_machine_name_load($scheme_machine_name, TRUE);
if (!empty($scheme)) {
// Add the scheme.
$export['features']['access_scheme'][$scheme->machine_name] = $scheme->machine_name;
// Add the module that provides the scheme type.
$module = $scheme->info['module'];
$export['dependencies'][$module] = $module;
// Add the modules that provide the attached handlers.
foreach ($scheme->handlers as $handler) {
if (!empty($handler)) {
$class = get_class($handler);
$module = $handler_info[$class]['module'];
$export['dependencies'][$module] = $module;
}
}
// Add all attached fields, including the realm field.
$fields = field_info_instances('access_grant', $scheme->machine_name);
foreach ($fields as $field) {
$key = "access_grant-{$field['bundle']}-{$field['field_name']}";
$pipe['field'][] = $key;
$pipe['field_instance'][] = $key;
}
}
}
return $pipe;
}