The following code will help you to create the popup in Drupal 8.
use \Drupal\Core\Ajax;
function testingPopup() { $response = new AjaxResponse(); $title = $this->t('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; }You can call the function testingPopup() , you will get the popup.
http://internetdevels.com/blog/creating-popups-in-Drupal-8
ReplyDelete