Tagged: enfold, Layout Builder, nested columns
-
AuthorPosts
-
May 8, 2014 at 5:23 am #261597
I need to be able to nest columns within each other and am having problems. I have a 1/4 + 3/4 layout, and would like to be able to put to 50% columns into the 3/4. They need to be editable with the drag-and-drop editor — it’s not ideal for me to just paste the shortcode into a text widget.
I was editing \config-templatebuilder\avia-shortcodes\columns.php and added the code below that you see at the bottom of this post. This allowed me to nest my new 1/2 column within the 3/4 just as I’d expect. However, when I save the page, it removes my nested column and places it adjacent to the 3/4 rather than inside it. I assume this is some setting in \config-templatebuilder\avia-template-builder\assets\js\avia-builder.js that I need to change, but am not sure what it is. I know this falls out of official theme support, but I’m really stuck and would appreciate guidance on what I need to change.
if ( !class_exists( ‘avia_sc_columns_one_half_inner’ ) )
{
class avia_sc_columns_one_half_inner extends avia_sc_columns{function shortcode_insert_button()
{
$this->config[‘name’] = ‘1/2 inner’;
$this->config[‘icon’] = AviaBuilder::$path[‘imagesURL’].”sc-half.png”;
$this->config[‘tab’] = __(‘Layout Elements’, ‘avia_framework’ );
$this->config[‘order’] = 90;
$this->config[‘shortcode’] = ‘av_one_half’;
$this->config[‘html_renderer’] = false;
$this->config[‘tinyMCE’] = array(‘name’ => ‘1/2 + 1/2’, ‘instantInsert’ => “[av_one_half first]Add Content here[/av_one_half]\n\n\n[av_one_half]Add Content here[/av_one_half]“);
$this->config[‘tooltip’] = __(‘Creates a single column with 50% width’, ‘avia_framework’ );
$this->config[‘drag-level’] = 3;
$this->config[‘drop-level’] = 2;
}
}
}Thanks very much!
May 8, 2014 at 4:32 pm #261857Is anyone able to help with this by chance? Very appreciative of any help, and happy to pay for guidance on this.
May 9, 2014 at 7:19 am #262177Hi!
I couldn’t get it to work by changing the php code – probably you must hack the template builder javascript code somehow but I’m not sure how much work is required. I’ll mark this thread for Kriesi and we’ll decide if this customization is doable or beyond the scope of our free support/service.
Cheers!
PeterMay 9, 2014 at 4:27 pm #262429Hi!
I am afraid those simple changes wont do :/ If it would be that easy we would have already added it ourself but making this work would require a major rewrite of some of the core javascript functions behind the template builder. thats why it hasnt happened yet.
Sorry for the bad news :/
Regards,
KriesiMay 9, 2014 at 4:43 pm #262444I got it almost working. But when I dragged items to my nested columns, it wouldn’t add their shortcode until I added something else to the page. If you’d like, I can send you the code I was working on for avia-builder.js in case you’re able to leverage it or get ideas from it.
May 9, 2014 at 4:45 pm #262446BTW, I would not be sending you the code because I want you to fix it for me — it makes sense that it’s a while off. I am simply offering it up in case it makes your life easier if you get to the point later where you want to add that in.
May 9, 2014 at 5:15 pm #262472The problem is that dragging and dropping is only the smallest part of what needs to be done. the script always needs to calculate which elements are located in which place in order to generate the shortcodes correctly (just an example)
What you currently do is only a manipulation of the visual layer but all the data storing etc that is happening in the background would need a rewrite as well ;(
I of course appreciate anything you post here so once I finally find the time to implement this feature I will have something to start with :)
May 9, 2014 at 5:47 pm #262495I have it calculating the shortcode correctly on all levels. You’re talking about the shortcode that’s nested in the hidden textarea, right? My fix is working in all capacities, except that there’s a delay between adding the shortcode data.
So in other words, if I dragged in 2 text widgets and then an image widget, the shortcode would only be added for those first two widgets. So the last widget i drag in essentially gets discarded, unless I make a change somewhere else in the layout builder. (resizing a column, dragging a widget to a standard drop level, etc.)
Here’s the file I was messing with, seems easier to link to it than paste thousands of lines of code: {removed}
Most of my tweaks start below line 640, with the functions that extract the shortcode data.
- This reply was modified 10 years, 6 months ago by zacholas321.
May 17, 2014 at 1:08 am #266042Hey!
Thanks again. I have copied the files for future reference, but it is indeed a little hackish ;D
If I am ever going to implement this I would of course need to position the existing column elements within each other which would make the whole thing much more complicated :)Thanks a lot nevertheless :)
Regards,
Kriesi -
AuthorPosts
- The topic ‘Layout builder: nest one column within another’ is closed to new replies.