You are here

function headerimage_settings_block_edit_validate in Header image 6

Same name and namespace in other branches
  1. 5 headerimage.module \headerimage_settings_block_edit_validate()
  2. 7 headerimage.module \headerimage_settings_block_edit_validate()

File

./headerimage.module, line 85
headerimage.module Conditionally display an node in a block.

Code

function headerimage_settings_block_edit_validate($form, &$form_state) {
  $blocks = headerimage_get_blocks();

  // Remove current blockname to prevent false error
  unset($blocks[$form_state['values']['delta']]);
  if (!empty($blocks)) {

    // Check if name is unique
    if (in_array($form_state['values']['title'], $blocks)) {
      form_set_error('', t('Header Image block %s already exists. Please use a different name.', array(
        '%s' => $form_state['values']['title'],
      )));
    }
  }
}