function block_patterns_export_all_block_roles in Patterns 7.2
Returns a set of PATTERNS_CREATE actions with the relationship between blocks and roles currently stored in the system.
Parameters
array $args Set of arguments received from the form.:
string $result Current set of actions for the whole process.:
Return value
array $result Set of actions after performing the changes.
1 string reference to 'block_patterns_export_all_block_roles'
- block_patterns in patterns_components/
components/ block.inc
File
- patterns_components/
components/ block.inc, line 159
Code
function block_patterns_export_all_block_roles($args = NULL, &$result = NULL) {
$result = array();
$block_node_roles = db_query('SELECT * from block_role');
//In this case the export is only as a set of modifys
foreach ($block_node_roles as $role) {
$data = array(
'tag' => 'block_role',
);
foreach ($role as $key => $value) {
//Transform the rid into the role name
if ($key == 'rid') {
$role = user_role_load($value);
$data['role'] = $role->name;
}
else {
$data[$key] = $value;
}
}
$action = array(
PATTERNS_CREATE => $data,
);
array_push($result, $action);
}
return $result;
}