Was there a recommend approach in Alchmey 6 for "fallback elements" #2441
-
We've used the fallback option for render_elements in quite a few places to allow a "global page" to provide the element unless over-written, which in most cases is what we want. However, I see this has been deprecated and subsequently removed in Alchemy 6 (#1982) Was there a recommended alternative to this now? Was this just a feature the team didn't want to support any more? Or was there a reason it needed to be removed? Just trying to understand what direction I should ideally take to migrate these pages onto Alchemy 6 (patching this method back in 😬 or changing the code to use a preferred approach in the library etc...) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Yes, and since this only works for HTML rendered elements and we're also want to support API driven sites. Also it was a feature hard to migrate into the versioned pages. I would recommend to build your own elements finder class. You can pass an instance of any class that inherits from alchemy_cms/app/helpers/alchemy/elements_helper.rb Lines 31 to 51 in 99b547f This gives you much more control over what to load and when. Probably want to add some proper caching and eager loading, etc. |
Beta Was this translation helpful? Give feedback.
-
Ah cool - have pulled code out of the Alchemy 5.x version of the code, and written a naive one as follows: As you say, might need some eager loading (although suspect this should be no worse than the current library code, given it's a straight copy/paste of what's needed)
|
Beta Was this translation helpful? Give feedback.
Ah cool - have pulled code out of the Alchemy 5.x version of the code, and written a naive one as follows:
As you say, might need some eager loading (although suspect this should be no worse than the current library code, given it's a straight copy/paste of what's needed)