You are here

protected function WebformOptionsCustomListBuilder::buildOptions in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_options_custom/src/WebformOptionsCustomListBuilder.php \Drupal\webform_options_custom\WebformOptionsCustomListBuilder::buildOptions()

Build options for a webform options custom entity.

Parameters

\Drupal\webform_options_custom\WebformOptionsCustomInterface $entity: A webform options custom entity.

Return value

string Options for a webform options custom entity.

1 call to WebformOptionsCustomListBuilder::buildOptions()
WebformOptionsCustomListBuilder::buildRow in modules/webform_options_custom/src/WebformOptionsCustomListBuilder.php
Builds a row for an entity in the entity listing.

File

modules/webform_options_custom/src/WebformOptionsCustomListBuilder.php, line 197

Class

WebformOptionsCustomListBuilder
Defines a class to build a listing of webform options custom entities.

Namespace

Drupal\webform_options_custom

Code

protected function buildOptions(WebformOptionsCustomInterface $entity) {
  $options = $entity
    ->getTemplateOptions();
  foreach ($options as $key => &$value) {
    if ($key !== $value) {
      $value .= ' (' . $key . ')';
    }
  }
  return implode('; ', array_slice($options, 0, 12)) . (count($options) > 12 ? '; …' : '');
}