You are here

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

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

Get title for form element.

Parameters

array $element: Element.

string $default: Default value for the title.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup|mixed Title value.

10 calls to CvValidatorBase::getElementTitle()
Email::getRules in src/Plugin/CvValidator/Email.php
Get the validation rules for this form element.
EqualTo::getRules in clientside_validation_jquery/src/Plugin/CvValidator/EqualTo.php
Get the validation rules for this 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.

... See full list

File

src/CvValidatorBase.php, line 89

Class

CvValidatorBase
Class CvValidatorBase.

Namespace

Drupal\clientside_validation

Code

protected function getElementTitle(array $element, $default = '') {
  $title = $this
    ->getAttributeValue($element, 'title');
  if (empty($title) && empty($default)) {
    return t('This field');
  }
  return $title ? $title : $default;
}