You are here

public function ParagraphsBrowserController::paragraphsBrowserSelect in Paragraphs Browser 8

Route callback that returns the Paragraphs Browser form within a modal.

Return value

string Returns the Ajax response to open dialog.

1 string reference to 'ParagraphsBrowserController::paragraphsBrowserSelect'
paragraphs_browser.routing.yml in ./paragraphs_browser.routing.yml
paragraphs_browser.routing.yml

File

src/Controller/ParagraphsBrowserController.php, line 24

Class

ParagraphsBrowserController
Class EntityBrowserController.

Namespace

Drupal\paragraphs_browser\Controller

Code

public function paragraphsBrowserSelect($field_config, $paragraphs_browser_type, $uuid) {
  $this
    ->setModalHeightAndWidth($field_config);
  $form = \Drupal::formBuilder()
    ->getForm('Drupal\\paragraphs_browser\\Form\\ParagraphsBrowserForm', $field_config, $paragraphs_browser_type, $uuid);
  $form['#attached']['library'][] = 'paragraphs_browser/modal';
  $title = $this
    ->t('Browse');
  $response = AjaxResponse::create()
    ->addCommand(new OpenModalDialogCommand($title, $form, [
    'modal' => TRUE,
    'width' => $this->modal_width,
    'height' => $this->modal_height,
  ]));
  return $response;
}