function block_access_check_submit in Block Access 6
Same name and namespace in other branches
- 6.2 block_access.module \block_access_check_submit()
- 7 block_access.module \block_access_check_submit()
1 call to block_access_check_submit()
File
- ./
block_access.module, line 383
Code
function block_access_check_submit($form, $key, $block) {
$valid = TRUE;
$name = array(
check_plain($block['info']),
);
// If the user is trying to disable the block but can't, report it
if ($block['region'] == BLOCK_REGION_NONE && $form[$key]['region']['#value'] != BLOCK_REGION_NONE && !block_access_can_delete($block['module']['#value'], $block['delta']['#value'])) {
drupal_set_message(t('You cannot disable @block.', $name));
$valid = FALSE;
}
elseif ($block['region'] != BLOCK_REGION_NONE && $form[$key]['region']['#value'] == BLOCK_REGION_NONE && !block_access_can_enable($block['module']['#value'], $block['delta']['#value'])) {
drupal_set_message(t('You cannot enable @block.', $name));
$valid = FALSE;
}
elseif ($block['region'] != BLOCK_REGION_NONE && $form[$key]['region']['#value'] != BLOCK_REGION_NONE && $block['region'] != $form[$key]['region']['#value'] && !block_access_can_move($block['module']['#value'], $block['delta']['#value'])) {
drupal_set_message(t('You cannot move @block.', $name));
$valid = FALSE;
}
return $valid;
}