-
AuthorPosts
-
March 8, 2018 at 5:29 am #923548
Hi,
I attempted to create a custom avia shortcode for the page builder for extending the library.
I found out that:
Enfold loads avia shortcodes by looping through all of the declared classes that have been declared in that request and checking if they extend aviaShortcodeTemplate. This is doing more work than it has to.
Enfold uses the class name as the href of the shortcode’s icon in the template builder. This breaks the link and the template disappears when dropping it onto the editing pane.
Shortcode Template Icon in on the page editor:
<a data-avia-tooltip="Creates a simple text block" data-dragdrop-level="3" href="#SomeNamespace\avia_sc_text" class="shortcode_insert_button avia-target-insert ui-draggable ui-draggable-handle"><img src="http://localhost/wp-content/themes/enfold/config-templatebuilder/avia-template-builder/images/sc-text_block.png" alt="Text Block"><span>Text Block</span></a>
As you can see
href="#SomeNamespace\avia_sc_text"
is an invalid link.Possible Solutions:
One possible solution to this could be replacing ‘\’ with ‘_’ and check for that in referencing locations. But this could potentially confuse two classes as the same class. ex. namespace\class ans namespace_class. These are two conventions available.
A better approach would be declaring a method abstract so the subclass can declare the tag it should have.
One possible improvement for the loader is to use a filter based system instead. Filter an array to add class names. Loop through the array and initialize only those templates. This
prevents looping over all declared classes which will lead to better execution time.Let me know your thoughts,
Jason GallavinMarch 8, 2018 at 10:46 am #923717Hey louisvillegeek,
Thanks for giving us your feedback and suggestion. :) I’ll forward your message to Kriesi and our devs.
Best regards,
NikkoMarch 9, 2018 at 6:14 am #924269Hi Nikko,
Thank you for forwarding it. :)
Let me know what they think.Thanks,
JasonMarch 10, 2018 at 10:08 pm #925036Hi,
There are multiple updates coming to ALB so that will also be added in a way to make sure that we are not loading things that we should not!
Best regards,
BasilisMarch 14, 2018 at 3:35 am #926368Hi Basilis,
That sounds great! Will these updates contains a fix for the ‘\’ character in name-spaced classes?
Thanks,
JasonMarch 15, 2018 at 8:30 pm #927651Hi,
It depends on the amount of things we will push on the next update – but yes we can make it basically based on that.
If it is not on the next, it will sure be one of the upcming releases.Just so you know, we appreciate that type of feedback really.
We are working to almost re-write the Avia Builder so those things will help us make it beter!If you notice anything else that you have feedback – please let us know!
Best regards,
Basilis -
AuthorPosts
- The topic ‘avia-template-builder Improvement’ is closed to new replies.