You are here

function email_verify_get_form_fields in Email Verify 7.2

Retrieves the forms and fields the admin specified to verify.

Parameters

string $form_id: The ID of the form to retrieve the fields for.

Return value

array An associative array with the key being the form and the

2 calls to email_verify_get_form_fields()
email_verify_form_alter in ./email_verify.module
Implements hook_form_alter().
email_verify_verify_address in ./email_verify.module
Additional validation for the form to verify the email address.

File

./email_verify.module, line 153
Verifies thoroughly that email addresses are correctly entered.

Code

function email_verify_get_form_fields($form_id) {
  $verify_form_fields = array();

  // Get the list of forms and fields.
  $email_verify_forms = variable_get('email_verify_forms', '');
  if (!empty($email_verify_forms)) {

    // Convert the text data into an array of strings, each representing one
    // form/field combination.
    $forms_and_fields = explode("\n", $email_verify_forms);

    // Process each form/field pair.
    foreach ($forms_and_fields as $form_and_field) {

      // Make sure it isn't an empty array element.
      if (!empty($form_and_field)) {
        $form_and_field = explode(',', $form_and_field);
        $form = trim($form_and_field[0]);
        $field = trim($form_and_field[1]);

        // If the form and field variables are not empty, and the form variable
        // matches $form_id, save the field ID.
        if (!empty($form) && !empty($field) && $form == $form_id) {
          $verify_form_fields[] = $field;
        }
      }
    }
  }
  return $verify_form_fields;
}