protected static function PostViewBuilder::buildLinks in Open Social 8.9
Same name and namespace in other branches
- 8 modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildLinks()
- 8.2 modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildLinks()
- 8.3 modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildLinks()
- 8.4 modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildLinks()
- 8.5 modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildLinks()
- 8.6 modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildLinks()
- 8.7 modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildLinks()
- 8.8 modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildLinks()
- 10.3.x modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildLinks()
- 10.0.x modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildLinks()
- 10.1.x modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildLinks()
- 10.2.x modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildLinks()
Build the default links (Read more) for a post.
Parameters
\Drupal\social_post\Entity\Post $entity: The post object.
string $view_mode: A view mode identifier.
Return value
array An array that can be processed by drupal_pre_render_links().
1 call to PostViewBuilder::buildLinks()
- PostViewBuilder::renderLinks in modules/
social_features/ social_post/ src/ PostViewBuilder.php - Lazy_builder callback; builds a post's links.
File
- modules/
social_features/ social_post/ src/ PostViewBuilder.php, line 206
Class
- PostViewBuilder
- Render controller for posts.
Namespace
Drupal\social_postCode
protected static function buildLinks(Post $entity, $view_mode) {
$links = [];
if ($entity
->access('update') && $entity
->hasLinkTemplate('edit-form')) {
$links['edit'] = [
'title' => t('Edit'),
'weight' => 10,
'url' => $entity
->urlInfo('edit-form'),
'query' => [
'destination' => \Drupal::destination()
->get(),
],
];
}
if ($entity
->access('delete') && $entity
->hasLinkTemplate('delete-form')) {
$links['delete'] = [
'title' => t('Delete'),
'weight' => 100,
'url' => $entity
->urlInfo('delete-form'),
'query' => [
'destination' => \Drupal::destination()
->get(),
],
];
}
return [
'#theme' => 'links',
'#links' => $links,
'#attributes' => [
'class' => [
'links',
'inline',
],
],
];
}