You are here

function block_admin_configure_validate in Drupal 7

Same name and namespace in other branches
  1. 4 modules/block.module \block_admin_configure_validate()
  2. 5 modules/block/block.module \block_admin_configure_validate()
  3. 6 modules/block/block.admin.inc \block_admin_configure_validate()

Form validation handler for block_admin_configure().

See also

block_admin_configure()

block_admin_configure_submit()

File

modules/block/block.admin.inc, line 448
Admin page callbacks for the block module.

Code

function block_admin_configure_validate($form, &$form_state) {
  if ($form_state['values']['module'] == 'block') {
    $custom_block_exists = (bool) db_query_range('SELECT 1 FROM {block_custom} WHERE bid <> :bid AND info = :info', 0, 1, array(
      ':bid' => $form_state['values']['delta'],
      ':info' => $form_state['values']['info'],
    ))
      ->fetchField();
    if (empty($form_state['values']['info']) || $custom_block_exists) {
      form_set_error('info', t('Ensure that each block description is unique.'));
    }
  }
}