You are here

public function WebformOptionsCustomListBuilder::buildRow in Webform 6.x

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

Builds a row for an entity in the entity listing.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity for this row of the list.

Return value

array A render array structure of fields for this entity.

Overrides EntityListBuilder::buildRow

See also

\Drupal\Core\Entity\EntityListBuilder::render()

File

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

Class

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

Namespace

Drupal\webform_options_custom

Code

public function buildRow(EntityInterface $entity) {

  /** @var \Drupal\webform_options_custom\WebformOptionsCustomInterface $entity */
  $row['label'] = [
    'data' => [
      'link' => $entity
        ->toLink($entity
        ->label(), 'edit-form')
        ->toRenderable(),
      'description' => [
        '#markup' => $entity
          ->get('description'),
        '#prefix' => '<br/>',
      ],
    ],
  ];
  $row['category'] = $entity
    ->get('category');
  $row['element'] = $entity
    ->get('element') ? $this
    ->t('Yes') : $this
    ->t('No');
  $row['entity_reference'] = $entity
    ->get('entity_reference') ? $this
    ->t('Yes') : $this
    ->t('No');
  $row['options'] = $this
    ->buildOptions($entity);
  $row['used_by'] = $this
    ->buildUsedBy($entity);
  return $row + parent::buildRow($entity);
}