Skip Navigation

[Resolved] Gallery Field

This thread is resolved. Here is a description of the problem and solution.

Problem:
Does Types have a Field like ACF's gallery fields?

Solution:
https://toolset.com/forums/topic/repeating-image-gallery-using-beaver-themer/#post-632395

This support ticket is created 6 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 13 replies, has 4 voices.

Last updated by Beda 5 years, 5 months ago.

Assisted by: Beda.

Author
Posts
#630577

I am trying to: display an image gallery on a custom post type created with Types. I created a custom field in Types that is a repeating field. I cannot get it to work with field connections in Beaver Themer.

Link to a page where the issue can be seen: it's a local dev site, sorry.

I expected to see: With ACF it's incredibly simple, I just select the field connection and voila. I can then style the gallery with the Beaver Builder options in the particular gallery module.

Instead, I got: Either errors or a single image displays.

#630733

Hi, I'm not aware of an integration with this feature in BB Pro / Beaver themer. I just tried it myself and I can see no images appear and a PHP warning appears as well. I will escalate this to my 2nd tier support team and see if there's anything we can do to make this work as expected. I'll update you as soon as I have more information to share.

#631013

At this time, our repeating image fields will not be accepted by the gallery module builder. It's difficult to use repeating image fields for galleries, even in our own system. There are a couple of tickets here in the forum that describe a Views-based approach:
https://toolset.com/forums/topic/how-to-display-the-pics-i-uploaded-as-a-slider/#post-518295
https://toolset.com/forums/topic/i-want-to-create-slider-from-1-post/page/2/

The preferred approach is to use a child custom post type, and insert each gallery image in the featured image of a new child post. Then you can use a View filtered by post relationship to build a slider-style gallery in the parent post.

#632297

Hi - I am Beda and analysed the issue that Christian reported to me for you.

As Christian outlines, using the repeating Image Field in the Gallery Module by inserting it's slug is not working properly.

The issue is due to a PHP warning that happens in the beaver builder plugin:

Warning: Invalid argument supplied for foreach() in /Applications/MAMP/htdocs/stable/wp-content/plugins/bb-plugin/modules/gallery/gallery.php on line

This happens because:
1. The code in beaver builder does not check what data is received and foreaches anyway over the variable.
This is not necessarily a broken code, best practice though is to check what you get before you work with it

2. In this case obviously, the expected value is not what Beaver Builder Receives when you use the repeating image field, resulting in the failing code.

I suspect, Beaver Builder expects an ID of the image, we deliver an URL.
The conflict will be unavoidable, but not unfixable.

I will do two things:
- I will try to figure out what ACF does differently. Maybe you can help me here by outlining the "simplest" steps I need to take with ACF PRO and Beaver Builder / Themer, so to have that gallery working with an ACF repeatable Image field
- I will discuss with the developers and our management what we can do "fix" this issue.

Technically, we would need to add a check for Beaver Builder Gallery and in that case, deliver the data they expect.
This requires something we call "Compatibility work".
We are in contact with the guys from Beaver Builder but I cannot guarantee you when and how we can or will add such a feature.

This depends on factors that I alone cannot decide.

Meanwhile, can you submit me the steps you take with ACF?
I hear they are simple and I would like to see what we can improve.

As well, in short, I will update you here whether I find a smooth workaround for this (I do not have great hopes for this though).

BTW; YOu can create gallery sliders with Toolset Views and repeating Fields, but you will need a specific module:
https://toolset.com/home/module-manager/ > FlexSlider.
This is as well what Christian already outlines, and what we would suggest as of right now to have it the smoothes way, is using the Child Post approach.

I look forward to hear back from you soon and will update you as well.

#632335
screenshot - in CPT adding images to ACF gallery.png
screenshot - Connecting ACF Gallery in Themer.png
screenshot - ACF Gallery Themer - Final Result.png
screenshot - ACF Gallery Setting.png

Hi Beda

Thank you for the detailed reply, and for trying to assist, I do appreciate your support efforts.

I've taken a few screenshots which I hope will clarify.

1. Install ACF and create custom field group and then add a gallery custom field, then assign to CPT.
2. In your CPT add the images to the gallery as you want.
3. In the CPT singular template being edited with Beaver Builder (with Beaver Themer activated) simple drag in a gallery module on the page where you want it, then click the connect button to connect to your custom field and voila.

Note: You'll then use the BB Gallery Module's settings to control the gallery itself e.g. pagination, slide settings, navigation arrows, lightbox settings etc.

Let me know if anything is unclear and I'll gladly clarify. I can even send through a screen recording if you wish?

Warmest regards,

Athlone Harris-Compton

#632374

Thank you for the feedback.

The first what jumps to my mind is "Gallery Field".
Our field is not a gallery field, it's an Image field.
It can be repeated, that is all.

ACF's "Gallery Field" is more. It is a field where a gallery is created on purpose, and it seems to either work accidentally or, and this is what I suspect, on purpose with the Gallery Module of Beaver Builder.

This is just a short notice to inform you about why and how things happen.

Toolset does simply not provide the feature as ACF does, it's not that Toolset or Beaver Builder are broken.
I want this to be clear because it will help understand why the coming process will not be as fast as when it is a BUG (a problem in our code, where something is going unexpectedly).

It's actually not expected to use those Fields with the gallery of Beaver Builder and clearly, we will need to change something here (I wish it will be as easy as change what we deliver with the field or change what Beaver Builder expects, but this may require more work).

I will now shortly debug this, and then see what I can come up with for right now.

#632394

Hi Beda

Thank you for the reply.

I figured that was the issue i.e. no gallery but a repeating field. As this is an important feature (Galleries in WordPress), would it not be a useful course of action to have something similar?

Warmest regards,

Athlone Harris-Compton

#632395

I saw only Beaver Builder alone (and that is the plugin we integrate with) is needed to create such a gallery.

The issue is not that it's either an ID or URL (well, that may become an issue later) but that the variable wich beaver builder expects to populate the foreach, if coming from our fields, will be a single value, hence you cannot loop over several.

When I create the field you mention in ACF (Gallery), I see that this is an entirely different field type.

This type of field does not exist within Toolset.

The ACF field produces an Array of all media that you added to ONE Field.
Toolset produces SEVERAL Fields that all have the same key but different meta ID.
Moreover, the array that ACF generates outputs the ID, just as Beaver Builder expects.

Hence, the changes that one would need to make here in Toolset are:
- either produce an entire new Field that does what ACF does (Gallery)
- or get the output of our current field with custom code and update a new field with a valid array or pass that array on the fly to Beaver Builder
- then, change the value output by our field with the ID of the attachment, instead of the URL.

For now, I have to suggest and admit that this with Types cannot be done without tampering with Custom code.
You can, however, do it within Toolset, when you do not use another Gallery provider (as above elaborated you can easily create galleries with Toolset).

For me, it is clear what, why and where it happens, and as well what we would need to do in order to add this feature.

But I cannot state whether or not the Developers will do it very soon.

I suggest that we close this ticket here as there is truly not much we can do right now in this scenario.

I am happy to let my colleagues assist you creating a gallery with the only Toolset in a new ticket.
For the beaver Builder gallery, I am afraid for now you will have to use ACF or massive custom code (massive because it would basically re-invent what ACF does already, just using a Types field)

#632397

Hi Beda

Thank you for the reply.

You're welcome to close this ticket, thank you.

I do hope this gets addressed sometime in the future as I don't really want to have to install ACF just to sure a gallery. 🙂

Warmest regards,

Athlone Harris-Compton

#634288

From the point of view of the report that you opened, for us, it is clear what is happening and what would need to happen in order to have that working.

Again, I cannot guarantee any form of ETA or promise something in regard.

I would like to mention again that with pure Toolset methods you can already create nice galleries.
It is a completely different approach, but it is one of the major features of Views.
We usually refer to it as "pagination".
See:
https://toolset.com/documentation/user-guides/views-pagination/
https://toolset.com/documentation/user-guides/custom-pagination-for-wordpress-archives/
https://toolset.com/documentation/user-guides/creating-sliders-with-types-and-views/
https://toolset.com/documentation/user-guides/displaying-sliders-in-different-parts-of-the-site/
https://toolset.com/documentation/user-guides/displaying-content-using-grids/

The main problem is, none of them works with repeating fields.
Only the FlexSlider method shared earlier in this thread uses repeating fields.
All other methods use other approaches (child posts, single fields and other)

With those you can though build practically the same as you illustrated to us in the opening comments with ACF and Gallery Modules.

#634454

Hi Beda

Would the solution then to create a gallery custom field like ACF does it instead of creating a repeating field with an image?

Warmest regards,

Athlone Harris-Compton

#634456

I am not sure to understand your last question, but with the provided solutions above, you would generally not use repeating fields, correct.

#1246808

Has this been given any more thought?

#1246916

We suggest opening a new ticket if you want to report an issue, or send in ideas and suggestions for Features in Toolset to the Product Management here directly:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/