public function CommerceLicenseExample::formValidate in Commerce License 7
Overrides CommerceLicenseBase::formValidate().
Overrides CommerceLicenseBase::formValidate
File
- modules/
commerce_license_example/ plugins/ license_type/ CommerceLicenseExample.class.php, line 59
Class
- CommerceLicenseExample
- Example license type.
Code
public function formValidate($form, &$form_state) {
parent::formValidate($form, $form_state);
$parents_path = implode('][', $form['#parents']);
$form_values = drupal_array_get_nested_value($form_state['values'], $form['#parents']);
// Validate the cle_name field value.
if ($form_values['cle_name'][LANGUAGE_NONE][0]['value'] == 'John Smith') {
form_set_error($parents_path . '][cle_name][und][0][value', t('John Smith is not allowed to have licenses.'));
}
}