TwitterWidgetListBuilder.php in Twitter Profile Widget 8
File
src/TwitterWidgetListBuilder.php
View source
<?php
namespace Drupal\twitter_profile_widget;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;
use Drupal\Core\Routing\LinkGeneratorTrait;
use Drupal\Core\Url;
class TwitterWidgetListBuilder extends EntityListBuilder {
use LinkGeneratorTrait;
public function buildHeader() {
$header['name'] = $this
->t('Widget label');
$header['type'] = $this
->t('Type');
$header['account'] = $this
->t('Twitter account');
$header['timeline'] = $this
->t('Timeline list');
$header['search'] = $this
->t('Search query');
$header['count'] = $this
->t('Display count');
$header['replies'] = $this
->t('Replies');
$header['retweets'] = $this
->t('Retweets');
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
$row['name'] = $this
->l($entity
->label(), new Url('entity.twitter_widget.canonical', [
'twitter_widget' => $entity
->id(),
]));
$row['type'] = $entity
->get('type')->value;
$row['account'] = $entity
->get('account')->value;
$row['timeline'] = $entity
->get('timeline')->value;
$row['search'] = $entity
->get('search')->value;
$row['count'] = $entity
->get('count')->value;
$row['replies'] = $entity
->get('replies')->value;
$row['retweets'] = $entity
->get('retweets')->value;
return $row + parent::buildRow($entity);
}
}