I'm really struggling with this issue. Well I'm having a view, in this view a field configured as personalized text as a link. I want to open a popup form on click on the link. Here is what I did in the method called by the link:
$response = new AjaxResponse(); $title = 'Title for the Popup.'; $form['#attached']['library'] = 'core/drupal.dialog.ajax'; $response->setAttachments($form['#attached']); $content = '<div class="test-popup-content">' . 'Content in HTML format' . '</div>'; $options = array( 'dialogClass' => 'popup-dialog-class', 'width' => '75%', ); $modal = new OpenModalDialogCommand($title, $content, $options); $response->addCommand($modal); return $response;
But It's not working at all! Please help!