You are here

function _node_registration_value_is_strtotime in Node registration 7

Form element validator for simple strtotime() format.

Possibly interesting regex: #(^|[^\+\d\-])(\d+)#

1 string reference to '_node_registration_value_is_strtotime'
_node_registration_type_settings_form in includes/node_registration.forms.inc
All registration settings for registration types and nodes.

File

includes/node_registration.forms.inc, line 1450
New registration forms. Public and admin.

Code

function _node_registration_value_is_strtotime($element, &$form_state, $form) {
  $value = $element['#value'];
  if ('' != $value) {
    if (!preg_match('#^(?:\\d+ (?:minute|hour|day|week|month)s? ?)+$#i', $value)) {
      form_error($element, t('%title must be a valid period.', array(
        '%title' => $element['#title'],
      )));
    }
  }
}