You are here

function _password_policy_admin_form_get_constraints in Password Policy 7

Gets constraints from submitted policy form.

Parameters

array $form_state: Form state.

Return value

array Constraints array.

1 call to _password_policy_admin_form_get_constraints()
_password_policy_admin_form_get_policy in ./password_policy.admin.inc
Gets policy from submitted policy form.

File

./password_policy.admin.inc, line 600
Admin page callback file for the Password Policy module.

Code

function _password_policy_admin_form_get_constraints(array $form_state) {
  $constraints = array();
  foreach ($form_state['values'] as $key => $value) {

    // If we have no form value, then we have no constraint to set.
    if (!is_array($value)) {

      // Dodge issues with roles array.
      $value = trim($value);
      if ($value != '' && preg_match('/^constraint_/', $key)) {
        $constraints[substr($key, 11)] = $value;
      }
    }
  }
  return $constraints;
}