function block_add_block_form_validate

block_add_block_form_validate($form, &$form_state)

Form validation handler for block_add_block_form().

See also

block_add_block_form()

block_add_block_form_submit()

File

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

Code

function block_add_block_form_validate($form, &$form_state) {
  $custom_block_exists = (bool) db_query_range('SELECT 1 FROM {block_custom} WHERE info = :info', 0, 1, array(':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.'));
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!block!block.admin.inc/function/block_add_block_form_validate/7.x