private function ParagraphsTableFormatter::paragraphsTableLinksAction in Paragraphs table 8
Links action.
1 call to ParagraphsTableFormatter::paragraphsTableLinksAction()
- ParagraphsTableFormatter::getPreparedRenderedEntities in src/
Plugin/ Field/ FieldFormatter/ ParagraphsTableFormatter.php - Prepare all of the given entities for rendering with applicable fields.
File
- src/
Plugin/ Field/ FieldFormatter/ ParagraphsTableFormatter.php, line 750
Class
- ParagraphsTableFormatter
- Plugin implementation of the 'paragraphs_table_formatter' formatter.
Namespace
Drupal\paragraphs_table\Plugin\Field\FieldFormatterCode
private function paragraphsTableLinksAction($paragraphsId = FALSE, $destination = '') {
$route_params = [
'paragraph' => $paragraphsId,
];
if (!empty($destination)) {
$route_params['destination'] = $destination;
}
$operation = [
'#type' => 'dropbutton',
'#links' => [
'view' => [
'title' => $this
->t('View'),
'url' => Url::fromRoute('entity.paragraphs_item.canonical', $route_params),
],
'edit' => [
'title' => $this
->t('Edit'),
'url' => Url::fromRoute('entity.paragraphs_item.edit_form', $route_params),
],
'duplicate' => [
'title' => $this
->t('Duplicate'),
'url' => Url::fromRoute('entity.paragraphs_item.clone_form', $route_params),
],
'delete' => [
'title' => $this
->t('Remove'),
'url' => Url::fromRoute('entity.paragraphs_item.delete_form', $route_params),
],
],
];
// Alter row operation.
\Drupal::moduleHandler()
->alter('paragraphs_table_operations', $operation, $paragraphsId);
return render($operation);
}