Commit 5d668a46 authored by aspilicious's avatar aspilicious Committed by tim.plunkett
Browse files

Issue #1711650 by aspilicious: Remove custom number validation.

parent 50d849f8
......@@ -409,22 +409,6 @@ function views_ui_add_form($form, &$form_state) {
return $form;
}
/**
* Helper form element validator: integer.
*
* The problem with this is that the function is private so it's not guaranteed
* that it might not be renamed/changed. In the future field.module or something else
* should provide a public validate function.
*
* @see _element_validate_integer_positive()
*/
function views_element_validate_integer($element, &$form_state) {
$value = $element['#value'];
if ($value !== '' && (!is_numeric($value) || intval($value) != $value)) {
form_error($element, t('%name must be a positive integer.', array('%name' => $element['#title'])));
}
}
/**
* Gets the current value of a #select element, from within a form constructor function.
*
......
......@@ -51,11 +51,11 @@ function option_definition() {
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['columns'] = array(
'#type' => 'textfield',
'#type' => 'number',
'#title' => t('Number of columns'),
'#default_value' => $this->options['columns'],
'#required' => TRUE,
'#element_validate' => array('views_element_validate_integer'),
'#min' => 0,
);
$form['alignment'] = array(
'#type' => 'radios',
......
......@@ -116,10 +116,9 @@ function build_form($form, &$form_state) {
$this->build_form_style($form, $form_state, 'page');
$form['displays']['page']['options']['items_per_page'] = array(
'#title' => t('Items to display'),
'#type' => 'textfield',
'#default_value' => '10',
'#size' => 5,
'#element_validate' => array('views_element_validate_integer'),
'#type' => 'number',
'#default_value' => 10,
'#min' => 0,
);
$form['displays']['page']['options']['pager'] = array(
'#title' => t('Use a pager'),
......@@ -253,10 +252,9 @@ function build_form($form, &$form_state) {
$this->build_form_style($form, $form_state, 'block');
$form['displays']['block']['options']['items_per_page'] = array(
'#title' => t('Items per page'),
'#type' => 'textfield',
'#default_value' => '5',
'#size' => 5,
'#element_validate' => array('views_element_validate_integer'),
'#type' => 'number',
'#default_value' => 5,
'#min' => 0,
);
$form['displays']['block']['options']['pager'] = array(
'#title' => t('Use a pager'),
......
Markdown is supported
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