You are here

public function PoolListBuilder::buildRow in CMS Content Sync 8

Same name and namespace in other branches
  1. 2.1.x src/Controller/PoolListBuilder.php \Drupal\cms_content_sync\Controller\PoolListBuilder::buildRow()
  2. 2.0.x src/Controller/PoolListBuilder.php \Drupal\cms_content_sync\Controller\PoolListBuilder::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

src/Controller/PoolListBuilder.php, line 61

Class

PoolListBuilder
Provides a listing of Pool.

Namespace

Drupal\cms_content_sync\Controller

Code

public function buildRow(EntityInterface $entity) {

  /**
   * @var \Drupal\cms_content_sync\Entity\Pool $entity
   */
  $row['name'] = $entity
    ->label();
  $row['id'] = $entity
    ->id();
  $row['backend_url'] = $entity
    ->getSyncCoreUrl();

  // Check of overwrites.
  $config = $this->configFactory
    ->get('cms_content_sync.pool.' . $entity
    ->id());
  $overwritten_backend_url = $config
    ->get('backend_url') != $entity
    ->getSyncCoreUrl();
  if ($overwritten_backend_url) {
    $row['backend_url'] .= ' <i>(' . $this
      ->t('Overwritten') . ')</i>';
  }
  $url = parse_url($row['backend_url']);
  $row['backend_url'] = new FormattableMarkup($url['host'], []);
  return $row + parent::buildRow($entity);
}