function multiblock_add_form_validate in MultiBlock 7
Same name and namespace in other branches
- 5 multiblock.module \multiblock_add_form_validate()
- 6 multiblock.module \multiblock_add_form_validate()
Validate "Add Block Instance" form.
File
- ./
multiblock.module, line 310 - Enhances the block API, as provided by D7 Core.
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_info') || !array_key_exists($orig_block['delta'], module_invoke($orig_block['module'], 'block_info'))) {
form_set_error('block', t('Module or block doesn\'t exist, contact administrator'));
}
}
}