You are here

function current_search_add_item_validate in Facet API 7.2

Same name and namespace in other branches
  1. 6.3 contrib/current_search/plugins/export_ui/current_search_export_ui.class.php \current_search_add_item_validate()
  2. 7 contrib/current_search/plugins/export_ui/current_search_export_ui.class.php \current_search_add_item_validate()

Form validation handler for current_search_settings_form(). Processed when the "Add item" button is selected.

1 string reference to 'current_search_add_item_validate'
current_search_settings_form in contrib/current_search/plugins/export_ui/current_search_export_ui.class.php
Define the preset add/edit form.

File

contrib/current_search/plugins/export_ui/current_search_export_ui.class.php, line 463
Export UI display customizations.

Code

function current_search_add_item_validate($form, &$form_state) {

  // NOTE: The form items are only required with the "Add item" button is
  // submitted, so we cannot use the #required property. Otherwise we could
  // not click the save or delete buttons without the form failing validation.
  if (empty($form_state['values']['plugins']['item_name'])) {
    $vars = array(
      '!name' => 'Item name',
    );
    form_set_error('item_name', t('!name field is required', $vars));
  }
  if (empty($form_state['values']['plugins']['item_label'])) {
    $vars = array(
      '!name' => 'Machine-readable name',
    );
    form_set_error('item_label', t('!name field is required', $vars));
  }
}