You are here

function party_plugin_display_party_piece::options_validate in Party 7

Same name and namespace in other branches
  1. 8.2 includes/views/party_plugin_display_party_piece.inc \party_plugin_display_party_piece::options_validate()

Validate the options form.

Overrides views_plugin_display::options_validate

File

includes/views/party_plugin_display_party_piece.inc, line 82
Views plugin for party pieces.

Class

party_plugin_display_party_piece
@file Views plugin for party pieces.

Code

function options_validate(&$form, &$form_state) {

  // It is very important to call the parent function here:
  parent::options_validate($form, $form_state);

  // Only allow word characters and hyphens.
  // TODO: make this match accented characters.
  if (preg_match('/[^\\w-]/', $form_state['values']['party_piece_path'])) {
    form_error($form['party_piece_path'], t('The path may only contain letters, numbers, underscores, and hyphens.'));
  }

  // Check for duplicate paths.
  $pieces = party_get_party_piece_info();
  if (isset($pieces[$form_state['values']['party_piece_path']])) {
    form_error($form['party_piece_path'], t('The path already exists.'));
  }
}