function multiblock_add_form_validate in MultiBlock 6
Same name and namespace in other branches
- 5 multiblock.module \multiblock_add_form_validate()
- 7 multiblock.module \multiblock_add_form_validate()
Validate "Add Block Instance" form.
File
- ./
multiblock.module, line 227
Code
function multiblock_add_form_validate($form, &$form_state) {
if (!isset($form_state['values']['instance'])) {
// Make sure we are getting a valid block to add.
if (!preg_match('/^.+\\*\\*\\*MB\\*\\*\\*.+$/', $form_state['values']['block'])) {
form_set_error('block', t('Bad block module input, contact administrator'));
return;
}
// Make sure the block and delta exist.
$orig_block = multiblock_blockinfo_from_form($form_state['values']['block']);
if (!module_hook($orig_block['module'], 'block') || !array_key_exists($orig_block['delta'], module_invoke($orig_block['module'], 'block', 'list'))) {
form_set_error('block', t('Module or block doesn\'t exist, contact administrator'));
}
}
}