You are here

function headerimage_settings_block_edit_validate in Header image 5

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

File

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

Code

function headerimage_settings_block_edit_validate($form_id, $form_values) {
  $blocks = headerimage_get_blocks();

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

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