You are here

function twitter_block_add_block_form_validate in Twitter Block 7

Same name and namespace in other branches
  1. 7.2 twitter_block.admin.inc \twitter_block_add_block_form_validate()

Form validation handler for twitter_block_add_block_form().

See also

twitter_block_add_block_form()

twitter_block_add_block_form_submit()

1 string reference to 'twitter_block_add_block_form_validate'
twitter_block_add_block_form in ./twitter_block.admin.inc
Form constructor for the add block form.

File

./twitter_block.admin.inc, line 37
Admin page callbacks for the Twitter Block module.

Code

function twitter_block_add_block_form_validate($form, &$form_state) {
  $twitter_block_exists = (bool) db_query_range('SELECT 1 FROM {twitter_block} WHERE info = :info', 0, 1, array(
    ':info' => $form_state['values']['info'],
  ))
    ->fetchField();
  if (empty($form_state['values']['info']) || $twitter_block_exists) {
    form_set_error('info', t('Ensure that each block description is unique.'));
  }
}