You are here

public function FlowListBuilder::buildRow in CMS Content Sync 2.1.x

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

Class

FlowListBuilder
Provides a listing of Flow.

Namespace

Drupal\cms_content_sync\Controller

Code

public function buildRow(EntityInterface $entity) {

  /**
   * @var \Drupal\cms_content_sync\Entity\Flow $entity
   */
  $row['name'] = $entity
    ->label();
  $row['id'] = $entity
    ->id();
  $config = $this->configFactory
    ->get('cms_content_sync.flow.' . $entity
    ->id());
  $overwritten = $config
    ->get('status') != $entity
    ->status();
  $active = $overwritten ? !$entity
    ->status() : $entity
    ->status();
  $status = $active ? $this
    ->t('Active') : $this
    ->t('Inactive');
  if ($overwritten) {
    $status .= ' <i>(' . $this
      ->t('Overwritten') . ')</i>';
  }
  if ($active) {
    if ($entity
      ->getController()
      ->needsEntityTypeUpdate()) {
      $status .= ' <i>(' . $this
        ->t('Requires export') . ')</i>';
    }
  }
  $row['status'] = new FormattableMarkup($status, []);
  return $row + parent::buildRow($entity);
}