function _block_patterns_mdtype_role in Patterns 7.2
Checks the existance of a block - role relationship with the given module, delta and rolename values (unique constraint).
Parameters
string $module Module from which the block originates:
string $delta Unique ID for a block within a module:
string $role Role in rolename format:
Return value
boolean TRUE if there is a configuration matching all the parameters, FALSE otherwise
1 call to _block_patterns_mdtype_role()
- block_patterns_validate in patterns_components/
components/ block.inc
File
- patterns_components/
components/ block.inc, line 759
Code
function _block_patterns_mdtype_role($module, $delta, $role) {
//Obtain the rid from the rolename, we don't need to check existance since we did it previously
$rid = user_role_load_by_name($role)->rid;
$query = db_select('block_role', 'br')
->fields('br')
->condition('module', $module)
->condition('delta', $delta)
->condition('rid', $rid)
->execute();
return $query
->rowCount() > 0;
}