Commit adc1d021 authored by Jelle Sebreghts's avatar Jelle Sebreghts
Browse files

coder review

parent baef0981
<?php
// $Id$
/**
* @file Admin settings for Clientside Validation
* @file
* Admin settings for Clientside Validation
*/
function clientside_validation_admin_settings() {
......@@ -134,7 +134,7 @@ function clientside_validation_admin_settings() {
}
//Error Placement
$form['clientside_validation_error_placement'] = array(
$form['clientside_validation_error_placement'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
......@@ -151,7 +151,7 @@ function clientside_validation_admin_settings() {
This function will be given to !errorPlacement',
array(
'!errorPlacement' =>
l('the errorPlacement option of jQuery.validate()', 'http://docs.jquery.com/Plugins/Validation/validate#options')
l(t('the errorPlacement option of jQuery.validate()'), 'http://docs.jquery.com/Plugins/Validation/validate#options')
)
),
'#options' => array(
......@@ -183,7 +183,7 @@ function clientside_validation_admin_settings() {
This function will be given to !errorPlacement',
array(
'!errorPlacement' =>
l('the errorPlacement option of jQuery.validate()', 'http://docs.jquery.com/Plugins/Validation/validate#options')
l(t('the errorPlacement option of jQuery.validate()'), 'http://docs.jquery.com/Plugins/Validation/validate#options')
)),
'#default_value' => variable_get('clientside_validation_custom_error_function', ''),
);
......
......@@ -60,7 +60,7 @@
* - specific characters for fapi_validation
* - regular expression for field_validation
*/
function hook_clientside_validation_rule_alter (&$js_rules, $element, $context) {
function hook_clientside_validation_rule_alter(&$js_rules, $element, $context) {
switch ($context['type']) {
case 'webform':
if ($context['rule']['validator'] == 'min_length') {
......
<?php
// $Id$
/*
* @file
* Clientside validation install file
*/
/**
* Implements hook_install
* Implements hook_install().
*/
function clientside_validation_enable() {
//support for module like e.g. select_or_other
......
<?php
// $Id$
/**
* @file
* Add client side validation to forms.
......@@ -68,7 +67,7 @@ function _clientside_validation_ajax_call() {
}
/**
* Implementation of hook_form_alter().
* Implements hook_form_alter().
*/
function clientside_validation_form_alter(&$form, &$form_state, $form_id) {
$page_match = TRUE;
......@@ -124,8 +123,8 @@ function clientside_validation_webform_after_build(&$form, &$form_state) {
$settings = array();
_clientside_validation_add_general_settings($settings, $form['#id']);
_clientside_validation_add_special_rules($js_rules, $settings, $form);
if (variable_get('clientside_validation_use_minified', 0) == 0) {
drupal_add_js(drupal_get_path('module', 'clientside_validation') . '/jquery-validate/jquery.validate.js');
}
......@@ -145,7 +144,7 @@ function _clientside_validation_add_special_rules(&$js_rules, &$settings, $form)
unset($js_rules['_groups']);
}
else {
$settings['clientsideValidation']['groups'][$form['#id']] = new stdclass();
$settings['clientsideValidation']['groups'][$form['#id']] = new stdClass();
}
foreach ($js_rules as $key => $rule) {
if (isset($rule['checkboxgroupminmax'])) {
......@@ -207,7 +206,7 @@ function clientside_validation_form_after_build(&$form, &$form_state) {
if (isset($form_ids[$form['#id']])) {
return $form;
}
drupal_alter("clientside_validation_form", $form, $form_state, $js_rules);
if (!empty($js_rules)) {
$settings = array();
......@@ -776,7 +775,7 @@ function _clientside_validation_set_ean($name, $title, &$js_rules, $message = ''
'placeholders' => array('!title' => $title),
'error_type' => 'ean',
'element_name' => $name
);
);
}
else {
$variables = array(
......@@ -795,7 +794,7 @@ function _clientside_validation_set_ean($name, $title, &$js_rules, $message = ''
*/
function _clientside_validation_set_regex($name, $title, &$js_rules, $expression, $message = '', $modifiers = "", $type = 'regex') {
$title = variable_get('clientside_validation_prefix', '') . $title . variable_get('clientside_validation_suffix', '');
if (empty($message)) {
if (empty($message)) {
$variables = array(
'message' => '!title field does not match the required pattern.',
'placeholders' => array('!title' => $title),
......@@ -953,7 +952,7 @@ function clientside_validation_drupal_json_encode($var) {
* Implements hook_theme().
*/
function clientside_validation_theme($existing, $type, $theme, $path) {
return array(
return array(
'clientside_error' => array(
'variables' => array(
'message' => '',
......
<?php
// $Id$
/**
* @file
* Add client side validation support for fapi validation
......@@ -57,10 +56,10 @@ function clientside_validation_fapi_regular($form_id, $element, &$js_rules) {
if (isset($rs[3]) && $rs[1] != 'regexp') {
$params[] = preg_split('/ *, */', $rs[3]);
}
else if (isset($rs[3])) {
elseif (isset($rs[3])) {
$params[] = $rs[3];
}
if (count($params) > 1) {
$params = $params[1];
}
......
<?php
// $Id$
/**
* @file
* Add clientside validation support for Field Validation
*/
function clientside_validation_field_validation_clientside_validation_form_alter(&$form, &$form_state, &$js_rules) {
/*if (isset($form['#entity_type']) && isset($form['#bundle'])) {
$rules = field_validation_get_bundle_rules($form['#entity_type'], $form['#bundle']);
if (!empty($rules)) {
foreach ($rules as $rule) {
if (isset($form[$rule['field_name']])) {
clientside_validation_field_validation_after_build_recurse($form['#id'], $form[$rule['field_name']], $form_state, $rule, $js_rules);
}
}
}
}*/
//clientside_validation_field_validation_after_build_recurse($form['#id'], $form[$rule['field_name']], $form_state, $rule, $js_rules);
$field_rules = array();
clientside_validation_field_validation_find_rules($form, $field_rules);
foreach ($field_rules as $rule) {
......
<?php
// $Id$
/**
* @file
* Add clientside validation to regular forms
......@@ -83,7 +81,7 @@ function clientside_validation_regular($form_id, $element, &$js_rules, $form_sta
_clientside_validation_set_minmax($el_name, $el_title, $min, $max, $js_rules);
}
}
switch($element['#number_type']) {
switch ($element['#number_type']) {
case 'decimal':
case 'float':
_clientside_validation_set_number_decimal($el_name, $el_title, $separator, $js_rules);
......
<?php
// $Id$
/**
* @file
* Add clientside validation support for html5 elements
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment