You are here

public function GeysirModalController::edit in Geysir 8

Create a modal dialog to edit a single paragraph.

1 string reference to 'GeysirModalController::edit'
geysir.routing.yml in ./geysir.routing.yml
geysir.routing.yml

File

src/Controller/GeysirModalController.php, line 116

Class

GeysirModalController
Controller for all modal dialogs.

Namespace

Drupal\geysir\Controller

Code

public function edit($parent_entity_type, $parent_entity_bundle, $parent_entity_revision, $field, $field_wrapper_id, $delta, $paragraph, $paragraph_revision, $js = 'nojs') {
  if ($js == 'ajax') {
    $response = new AjaxResponse();
    $form = $this
      ->entityFormBuilder()
      ->getForm($paragraph_revision, 'geysir_modal_edit', []);
    $paragraph_title = $this
      ->getParagraphTitle($parent_entity_type, $parent_entity_bundle, $field);
    $response
      ->addCommand(new GeysirOpenModalDialogCommand($this
      ->t('Edit @paragraph_title', [
      '@paragraph_title' => $paragraph_title,
    ]), render($form)));
    return $response;
  }
  return $this
    ->t('Javascript is required for this functionality to work properly.');
}