You are here

protected function CvValidatorBase::getAttributeValue in Clientside Validation 2.0.x

Same name and namespace in other branches
  1. 8.2 src/CvValidatorBase.php \Drupal\clientside_validation\CvValidatorBase::getAttributeValue()
  2. 8 src/CvValidatorBase.php \Drupal\clientside_validation\CvValidatorBase::getAttributeValue()
  3. 3.0.x src/CvValidatorBase.php \Drupal\clientside_validation\CvValidatorBase::getAttributeValue()

Get the value of an attribute of an element.

Parameters

array $element: The element to get the attribute from.

string $attribute: The attribute of which to get the value.

Return value

mixed The attribute value.

6 calls to CvValidatorBase::getAttributeValue()
CvValidatorBase::getElementTitle in src/CvValidatorBase.php
Get title for form element.
Max::getRules in src/Plugin/CvValidator/Max.php
Get the validation rules for this form element.
MaxLength::getRules in src/Plugin/CvValidator/MaxLength.php
Get the validation rules for this form element.
Min::getRules in src/Plugin/CvValidator/Min.php
Get the validation rules for this form element.
Required::getRules in src/Plugin/CvValidator/Required.php
Get the validation rules for this form element.

... See full list

File

src/CvValidatorBase.php, line 72

Class

CvValidatorBase
Class CvValidatorBase.

Namespace

Drupal\clientside_validation

Code

protected function getAttributeValue(array $element, $attribute) {
  return isset($element['#' . $attribute]) ? $element['#' . $attribute] : (isset($element['#attributes'][$attribute]) ? $element['#attributes'][$attribute] : NULL);
}