You are here

protected function BarcodeBase::getTypesString in Barcode 8

Generates a string representation of an array of allowed types.

This string format is suitable for editing in a textarea.

Parameters

array $values: An array of barcode types, where keys are types and values are labels.

Return value

string The string representation of the $values array:

  • Types are separated by a carriage return.
  • Each type is in the format "type|label".
1 call to BarcodeBase::getTypesString()
BarcodeBase::storageSettingsForm in src/Plugin/Field/FieldType/BarcodeBase.php
Returns a form for the storage-level settings.

File

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

Class

BarcodeBase

Namespace

Drupal\barcode\Plugin\Field\FieldType

Code

protected function getTypesString($types) {
  foreach ($types as $type => $label) {
    $lines[] = "{$type}|{$label}";
  }
  return implode("\n", $lines);
}