You are here

function theme_clientside_error in Clientside Validation 6

Same name and namespace in other branches
  1. 7 clientside_validation.module \theme_clientside_error()

Theme callback function.

Parameters

array $variables: An array with the following keys: 'message': A string containing the error message 'placeholders': An associative array of replacements to make after translation. Incidences of any key in this array are replaced with the corresponding value. Based on the first character of the key, the value is escaped and/or themed: !variable: inserted as is @variable: escape plain text to HTML (check_plain) %variable: escape text and theme as a placeholder for user-submitted content (check_plain + theme_placeholder) 'error_type': The error type of this error message (e.g. 'required', 'min', 'max', 'range', 'decimal', 'number', ...) 'element_name': The name attribute of the element the error is for.

Return value

string

22 theme calls to theme_clientside_error()
_clientside_validation_set_blacklist in ./clientside_validation.module
Set validation rule for fields that can not consist of one or more specific values
_clientside_validation_set_checkboxgroup_minmax in ./clientside_validation.module
Set validation rule for checkboxes.
_clientside_validation_set_dategroup_required in ./clientside_validation.module
Set validation rule for dates
_clientside_validation_set_ean in ./clientside_validation.module
Set validation rule for ean number fields.
_clientside_validation_set_email in ./clientside_validation.module
Set validation rule for email fields.

... See full list

File

./clientside_validation.module, line 1057
Add client side validation to a webform.

Code

function theme_clientside_error($variables) {
  if (!is_array($variables)) {
    $args = func_get_args();
    $variables['message'] = isset($args[0]) ? $args[0] : '';
    $variables['placeholders'] = isset($args[1]) ? $args[1] : array();
    $variables['error_type'] = isset($args[2]) ? $args[2] : '';
    $variables['element_name'] = isset($args[3]) ? $args[3] : '';
  }
  if (!array_key_exists('message', $variables)) {
    $variables['message'] = '';
  }
  if (!array_key_exists('placeholders', $variables)) {
    $variables['placeholders'] = array();
  }
  if (!array_key_exists('error_type', $variables)) {
    $variables['error_type'] = '';
  }
  if (!array_key_exists('element_name', $variables)) {
    $variables['element_name'] = '';
  }
  return t($variables['message'], $variables['placeholders']);
}