Popup another drupal page without the whole drupal theme in the popup?

Created on 11 December 2023, 12 months ago
Updated 14 December 2023, 11 months ago

I have content where I link to other nodes. Those nodes are very small. Rather than changing pages, I just want to show that other content in a popup.

I was able to get glightbox to popup the other page just as advertised. But I only want the content of that page and not the whole header, menu, footer, etc. Is there a way to do that with glightbox (or some other way)?

πŸ’¬ Support request
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States eahonet

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @eahonet
  • Status changed to Needs review 12 months ago
  • πŸ‡·πŸ‡ΈSerbia levmyshkin Novi Sad, Serbia

    Hi eahonet, for your case it will be easier to use 'use-ajax' class:
    https://www.drupal.org/docs/develop/drupal-apis/ajax-api/ajax-dialog-boxes β†’

    But you will be needed to include libraries in dependencies:

      dependencies:    
        - core/jquery #Just to be safe
        - core/drupal.dialog.ajax #Required for dialogs
        - core/jquery.form #If you also want to use Ajax for form operations

    As it's described in the article above.

    It's also possible to do with GLightbox. You need to enable GLightbox Inline module, then it will be possible to call pages and return content from specified ID. If you pass id for block after base URL, then only this block will be loaded in popup. Also you need to add 'glightbox-inline' for this kind of links:

    It works using jQuery .load() under the hood or similar way:
    https://api.jquery.com/load/

  • πŸ‡ΊπŸ‡ΈUnited States eahonet

    This was very helpful @levmyshkin

    But note: if the ID exists on the current page, it will pull that rather than the ID'd section from the linked page. That's what made me think it didn't work. Once I added a different ID to the other page it worked as expected.

  • πŸ‡·πŸ‡ΈSerbia levmyshkin Novi Sad, Serbia
  • Status changed to Fixed 11 months ago
  • πŸ‡·πŸ‡ΈSerbia levmyshkin Novi Sad, Serbia
Production build 0.71.5 2024