function party_plugin_display_party_piece::options_validate in Party 8.2
Same name and namespace in other branches
- 7 includes/views/party_plugin_display_party_piece.inc \party_plugin_display_party_piece::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.'));
}
}