You are here

private function AjaxController::paragraphsTableLinksAction in Paragraphs table 8

3 calls to AjaxController::paragraphsTableLinksAction()
AjaxController::getData in src/Controller/AjaxController.php
AjaxController::getResults in src/Controller/AjaxController.php
AjaxController::getTable in src/Controller/AjaxController.php

File

src/Controller/AjaxController.php, line 271

Class

AjaxController
Returns responses for paragraphs item routes.

Namespace

Drupal\paragraphs_table\Controller

Code

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);
}