1 menu.admin.inc menu_settings_form_validate($form, &$form_state)

Validate form values for the global settings form.

File

core/modules/menu/menu.admin.inc, line 794
Admin page callbacks for the Menu module.

Code

function menu_settings_form_validate($form, &$form_state) {
  // Do some basic validation of the menu breakpoint setting.
  if ($form_state['values']['menu_breakpoint'] == 'custom') {
    // This list of CSS units has been taken from:
    // https://developer.mozilla.org/en-US/docs/Web/CSS/length
    if (!preg_match('/^[0-9.]+(px|em|ch|ex|rem|vh|vw|vmin|vmax|cm|mm|in|pc|pt)$/i', $form_state['values']['menu_breakpoint_custom'])) {
      form_set_error('menu_breakpoint_custom', t("'@breakpoint' does not appear to be a valid CSS width value.", array(
        '@breakpoint' => $form_state['values']['menu_breakpoint_custom'],
      )));
    }
  }
}