You are here

public function WebformContentCreatorListBuilder::buildRow in Webform Content Creator 3.x

Same name and namespace in other branches
  1. 8 src/Controller/WebformContentCreatorListBuilder.php \Drupal\webform_content_creator\Controller\WebformContentCreatorListBuilder::buildRow()
  2. 2.x src/Controller/WebformContentCreatorListBuilder.php \Drupal\webform_content_creator\Controller\WebformContentCreatorListBuilder::buildRow()

Constructs the table rows.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: Webform content creator entity.

Return value

\Drupal\Core\Entity\EntityListBuilder A render array structure of fields for this entity.

Overrides EntityListBuilder::buildRow

File

src/Controller/WebformContentCreatorListBuilder.php, line 42

Class

WebformContentCreatorListBuilder
Provides a list of Webform Content Creator entities.

Namespace

Drupal\webform_content_creator\Controller

Code

public function buildRow(EntityInterface $entity) {
  $webform = \Drupal::entityTypeManager()
    ->getStorage(self::WEBFORM)
    ->load($entity
    ->getWebform());
  $content_type = \Drupal::entityTypeManager()
    ->getStorage('node_type')
    ->load($entity
    ->getContentType());
  if (!empty($webform) && !empty($content_type)) {
    $row[self::TITLE] = $entity
      ->get('title') . ' (' . $entity
      ->id() . ')';
    $row[self::WEBFORM] = $webform
      ->label() . ' (' . $entity
      ->getWebform() . ')';
    $row[self::CONTENT_TYPE] = $content_type
      ->label() . ' (' . $entity
      ->getContentType() . ')';
    return $row + parent::buildRow($entity);
  }
  return parent::buildRow($entity);
}