You are here

public function SmartDateFormatListBuilder::buildRow in Smart Date 3.1.x

Same name and namespace in other branches
  1. 8.2 src/Entity/SmartDateFormatListBuilder.php \Drupal\smart_date\Entity\SmartDateFormatListBuilder::buildRow()
  2. 8 src/Entity/SmartDateFormatListBuilder.php \Drupal\smart_date\Entity\SmartDateFormatListBuilder::buildRow()
  3. 3.x src/Entity/SmartDateFormatListBuilder.php \Drupal\smart_date\Entity\SmartDateFormatListBuilder::buildRow()
  4. 3.0.x src/Entity/SmartDateFormatListBuilder.php \Drupal\smart_date\Entity\SmartDateFormatListBuilder::buildRow()
  5. 3.2.x src/Entity/SmartDateFormatListBuilder.php \Drupal\smart_date\Entity\SmartDateFormatListBuilder::buildRow()
  6. 3.3.x src/Entity/SmartDateFormatListBuilder.php \Drupal\smart_date\Entity\SmartDateFormatListBuilder::buildRow()
  7. 3.4.x src/Entity/SmartDateFormatListBuilder.php \Drupal\smart_date\Entity\SmartDateFormatListBuilder::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/Entity/SmartDateFormatListBuilder.php, line 31

Class

SmartDateFormatListBuilder
Defines a class to build a listing of Smart date formats.

Namespace

Drupal\smart_date\Entity

Code

public function buildRow(EntityInterface $entity) {

  /* @var $entity \Drupal\smart_date\Entity\SmartDateFormat */
  $row['query'] = Link::createFromRoute($entity
    ->label(), 'entity.smart_date_format.edit_form', [
    'smart_date_format' => $entity
      ->id(),
  ]);

  // Show a preview and list the primary PHP codes.
  $formatted = SmartDateTrait::formatSmartDate(time(), time() + 3600, $entity
    ->getOptions(), NULL, 'string');
  $row['preview']['data'] = $formatted;
  $row['date_format']['data'] = $entity
    ->get('date_format');
  $row['time_format']['data'] = $entity
    ->get('time_format');
  return $row + parent::buildRow($entity);
}