You are here

function view_mode_page_form_validate in View Mode Page 7.2

Same name and namespace in other branches
  1. 8.2 view_mode_page.module \view_mode_page_form_validate()

Validation handler for the pattern submit

1 string reference to 'view_mode_page_form_validate'
view_mode_page_form_alter in ./view_mode_page.module
Implements hook_page_alter().

File

./view_mode_page.module, line 121
View Mode Page module allows users to add a page for a specific view mode.

Code

function view_mode_page_form_validate($form, &$form_state) {
  $pattern = $form_state['values']['additional_settings']['view_mode_page_settings']['view_mode_page_url_pattern'];

  // the pattern cannot start with '%'
  if (preg_match('/^%/', $pattern)) {
    form_set_error('view_mode_page_url_pattern', t('Patterns should not start with a wildcard (%)'));
  }
}