public function SocialPostListBuilder::buildRow in Social Post 8.2
Same name and namespace in other branches
- 3.x src/Entity/Controller/SocialPostListBuilder.php \Drupal\social_post\Entity\Controller\SocialPostListBuilder::buildRow()
Parameters
\Drupal\social_post\Entity\SocialPost|Drupal\Core\Entity\EntityTypeInterface $entity: The Social Post entity to render.
Overrides EntityListBuilder::buildRow
File
- src/
Entity/ Controller/ SocialPostListBuilder.php, line 102
Class
- SocialPostListBuilder
- Defines a class to build a listing of Social Post Entities.
Namespace
Drupal\social_post\Entity\ControllerCode
public function buildRow(EntityInterface $entity) {
$provider = $entity
->getPluginId();
if ($provider == 'social_post_' . $this->provider) {
$row['provider_user_id'] = $entity
->getProviderUserId();
// Generates (or not) URL to user profile.
$link = $entity
->getLink();
if ($link
->isEmpty()) {
$row['social_post_name'] = $entity
->getName();
}
else {
$row['social_post_name'] = Link::fromTextAndUrl($link->title, $link
->getUrl());
}
$user = $this->userEntity
->load($entity
->getUserId());
$row['user'] = $user
->toLink();
return $row + parent::buildRow($entity);
}
return [];
}