You are here

protected static function BarcodeBase::validateType in Barcode 8

Checks whether a candidate allowed value is valid.

Parameters

string $type: The type entered by the user.

Return value

string | null The error message if the specified type is invalid, NULL otherwise.

1 call to BarcodeBase::validateType()
BarcodeBase::validateTypes in src/Plugin/Field/FieldType/BarcodeBase.php
#element_validate callback for options field allowed values.

File

src/Plugin/Field/FieldType/BarcodeBase.php, line 233

Class

BarcodeBase

Namespace

Drupal\barcode\Plugin\Field\FieldType

Code

protected static function validateType($type) {
  if (!isset(static::$types[$type])) {
    return t('Allowed Type list: type %type is invalid', [
      '%type' => $type,
    ]);
  }
}