You are here

function mass_contact_admin_edit_validate in Mass Contact 7

Same name and namespace in other branches
  1. 5.2 mass_contact.module \mass_contact_admin_edit_validate()
  2. 5 mass_contact.module \mass_contact_admin_edit_validate()
  3. 6 mass_contact.module \mass_contact_admin_edit_validate()

Validates the submission of the category add/edit page.

Parameters

array $form: An associative array containing the structure of the form.

array $form_state: A keyed array containing the current state of the form.

File

./mass_contact.admin.inc, line 149
The administrative settings pages.

Code

function mass_contact_admin_edit_validate(array $form, array &$form_state) {

  // Execute validation callbacks for each plugin.
  ctools_include('plugins');

  // Get the information about all plugins that implemnent this type of plugin.
  $plugins = ctools_get_plugins('mass_contact', 'grouping_method');
  $values_empty = TRUE;
  foreach ($plugins as $plugin) {

    // Get the admin edit validate function name for this particular
    // implementation.
    $function = ctools_plugin_get_function($plugin, 'mass_contact_admin_edit_validate');
    if ($values_empty) {

      // Call the plugin function to validate the form.
      $values_empty = $function($form, $form_state);
    }
  }

  // If all validation callbacks return TRUE that means that user
  // hasn't selected any selection rules.
  if ($values_empty) {
    form_set_error('recipients', t('You must check one or more recipients.'));
  }
}