You are here

function jsonlog_form_system_logging_settings_validate in JSONlog 7

Same name and namespace in other branches
  1. 8.2 jsonlog.module \jsonlog_form_system_logging_settings_validate()
  2. 8 jsonlog.module \jsonlog_form_system_logging_settings_validate()
  3. 7.2 jsonlog.module \jsonlog_form_system_logging_settings_validate()
  4. 3.x jsonlog.module \jsonlog_form_system_logging_settings_validate()

_state

Parameters

array $form:

1 string reference to 'jsonlog_form_system_logging_settings_validate'
jsonlog_form_system_logging_settings_alter in ./jsonlog.module
Adds this module's setting fields to the system logging settings form.

File

./jsonlog.module, line 376
JSONlog module.

Code

function jsonlog_form_system_logging_settings_validate($form, $form_state) {
  $values =& $form_state['values'];

  // Non-empty truncate must be non-negative integer.
  if ($values['jsonlog_truncate'] !== '' && ($value = trim($values['jsonlog_truncate'])) !== '') {
    if (!preg_match('/^\\d+$/', $value)) {
      form_set_error('jsonlog_truncate', t('\'@field\' is not a non-negative integer.', array(
        '@field' => t('Truncate events to'),
      )));
    }
  }
}