Image block lightbox

Permalink 1 user found helpful
Hi community,

this is my first time with concrete5 - it's a very good and simple cms - the docs are great but I can't find:

How to enable lightbox for the image block?

:) Thank you!

---
Edit:

Sorry, more informations:
- I use my own theme
- I use 5.7

View Replies: View Best Answer
mnakalay replied on at Permalink Reply
mnakalay
Hello,
the image block doesn't offer a popup functionality.

You can, however, insert an image in a content block, make it a link and choose to open the link in a popup
machomaaan replied on at Permalink Reply
Hi mnakalay,

thank you for this information.

But to the core team:
Why there is no option to open the image in a lightbox when using image block?

Thank you!
ramonleenders replied on at Permalink Reply
ramonleenders
Well, people could use either Bootstrap or Foundation. Both have different ways of opening a popup. And even if you use either of them, who says you want to use THEIR functionality. Maybe you want to include your own popup functionality, LightBox, LightBox2 or whatever other popup plugin there is available. This makes it pretty hard to know what to output to make it work for the plugin you are using.
machomaaan replied on at Permalink Reply
Yes, you are right! ;)

Are there docs for it (e.g. how to integrate lightbox2)?

Thank you!
ramonleenders replied on at Permalink Reply
ramonleenders
You should view that per plugin. So for LightBox2, look here:

http://lokeshdhakar.com/projects/lightbox2/#getting-started...

You can override the template of the "Image" block type, but getting your lightbox/popup plugin to work is priority #1. Then change the template to how it should be.
mnakalay replied on at Permalink Best Answer Reply
mnakalay
it would probably be simpler to use Magnific Popup since it is included with Concrete5.
It is also a very solid one that works pretty much flawlessly.
machomaaan replied on at Permalink Reply
Oh cool, Magnific Popup is included? Great!
I think I need to load it in my page_theme.php (register assets)?!
JohntheFish replied on at Permalink Reply
JohntheFish
mnakalay replied on at Permalink Reply
mnakalay
adding it to page_theme.php is an option but it depends on what you want to do.

If you do it that way, the script will load on every page unless you write dome logic to select specific pages.

But since you are going to have to write a template for the image block anyway, to add settings for magnific popup, you can simply require the asset (the lightbox script) from the template itself.
machomaaan replied on at Permalink Reply
Great job guys!

Thank you very much!
dessisan replied on at Permalink Reply 1 Attachment
I'm currently building a website with concrete5 Version 8.4.3. The rich text editor (CKEditor 4) in the content block ships with a plugin called 'concrete5 Link', see comment about it here:

https://documentation.concrete5.org/editors/dashboard/system-and-mai...

The 'concrete5 Link'-plugin provides an image lightbox creation, which can be activated by choosing the 'lighbox'-Option in the Dropdown-Menu 'target' of the link attributes. This way clicking on the image opens a lightbox, which inspecting the created markup seems to rely on 'Magnific Popup' shipped with the concrete5-package.

Important: The 'lightbox'-Option is NOT in the dropdown of the link-option of the 'image'-plugin. You have to put the link on the image by clicking on the 'link'-icon in the text-editor-menu-bar. There you can find the 'lightbox'-Option (see screenshot in the file attached).

Being no programmer, I spent two days based on this thread trying to figure out a workaround for the missing lightbox-option in the core image block, and was already on the way to try 'copy-paste-image-block-to-packages-folder' + 'page_theme.php > requireAsset('core/lightbox') + 'code-analyzing-"finicking" in the copied image block'.

Happily enough this morning I came through the built-in-'lightbox'-Option in the content block, which saves me uncounted hours of 'coding-trials'.

So I thought to post this here for other people looking for information about built-in-lightbox-facilitiy in concrete5.