You are here

public function FlexiformElementEntityProperty::formValidate in Flexiform 7

Validate the form element.

Overrides FlexiformElement::formValidate

File

includes/element/property.element.inc, line 130
Contains class for the entity property elements.

Class

FlexiformElementEntityProperty
Class to add an element for entity properties.

Code

public function formValidate($form, &$form_state, $entity, $language = LANGUAGE_NONE) {
  $value = $this
    ->formExtractValues($form, $form_state, $entity);
  if (!$this
    ->wrapper($entity)
    ->get($this->property)
    ->validate($value)) {
    form_error($form[$this->element_namespace], t('Invalid value given for !label', array(
      '!label' => $this
        ->label(),
    )));
  }
}