Tagged: add_more slowdown
- This topic has 4 replies, 3 voices, and was last updated 3 years, 10 months ago by
friendlyfire3.
-
AuthorPosts
-
-
March 12, 2018 at 10:37 am #8778
juxtaParticipantHello
I’m new to Piklist, and am trying to build something like the ‘flexible content’ block of ACF (though not as complicated or with as many options), based partly on some code I found on the forum. As I’ve been adding more complexity, it’s got to the point where there’s a 5-10 second delay whenever I click the ‘+’ button to add more ‘blocks’. I haven’t found anything in the forums that answered this specific issue and my concern is that even though it seems to work (i.e. save the data) it’s going to be unusable for the client. Hopefully it’s just something I’m doing wrong that’s easily fixable: I post the full code that I’m using below in case that helps.
Thanks
P.S. Piklist seems great, so I hope to be able to use it for what I’m trying to do.
piklist('field', array( 'type' => 'group', 'field' => 'flexible_content', 'label' => 'Sections', 'value' => 'none', 'add_more' => true, 'fields' => array( array( 'type' => 'select', 'field' => 'module_select', 'label' => 'Select a Module', 'columns' => 12, 'choices' => array( 'none' => 'Select a Module to add', 'module' => 'WYSIWYG', // 'module_image' => 'Image', 'module_link' => 'Link', 'module_pdf' => 'PDF', ) ), array( 'type' => 'group', 'field' => 'module_editor', 'fields' => array( array( 'type' => 'editor', 'field' => 'wysiwyg', 'columns' => 12, 'options' => array( 'wpautop' => true, 'media_buttons' => true, 'tabindex' => '', 'editor_css' => '', 'editor_class' => true, 'teeny' => false, 'dfw' => false, 'tinymce' => true, 'quicktags' => true ), ), // WYSIWYG array( 'type' => 'select', 'field' => 'quote_or_stat_select', 'label' => 'Add a quote or stat (optional)', 'choices' => array( 'none' => 'Select an option', 'quote' => 'Pullquote', 'stat' => 'Stat', ) ), // Optional add QUOTE or STAT array( 'type' => 'textarea', 'field' => 'quote', 'label' => 'Pullquote', 'attributes' => array( 'rows' => 2, 'class' => 'large-text' ), 'conditions' => array( array( 'field' => 'flexible_content:module_editor:quote_or_stat_select', 'value' => 'quote' ) ), ), // Quote array( 'type' => 'group', 'field' => 'stat', 'fields' => array( array( 'type' => 'text', 'field' => 'stat_title', 'label' => 'Title', 'attributes' => array( 'class' => 'large-text' // WordPress css class ) ), array( 'type' => 'textarea', 'field' => 'stat_text', 'label' => 'Text', 'attributes' => array( 'rows' => 2, 'class' => 'large-text' ) ), array( 'type' => 'select', 'field' => 'stat_icon', 'label' => 'Choose an icon', 'choices' => array( 'icon_a' => 'Icon A', 'icon_b' => 'Icon B', 'icon_c' => 'Icon C', ) ), // Optional add QUOTE or STAT ), 'conditions' => array( array( 'field' => 'flexible_content:module_editor:quote_or_stat_select', 'value' => 'stat' ) ), ), // Stat ), 'conditions' => array( array( 'field' => 'flexible_content:module_select', 'value' => 'module' ) ), ), // WYSIWYG array( 'type' => 'group', 'label' => '', 'field' => 'module_link', 'fields' => array( array( 'type' => 'text', 'field' => 'link_title', 'label' => 'Title', 'attributes' => array( 'class' => 'large-text' // WordPress css class ) ), array( 'type' => 'textarea', 'field' => 'link_text', 'label' => 'Text', 'attributes' => array( 'rows' => 2, 'class' => 'large-text' ) ), array( 'type' => 'text', 'field' => 'link_button_title', 'label' => 'Button title', 'attributes' => array( 'class' => 'large-text' // WordPress css class ) ), array( 'type' => 'select', 'field' => 'link_button_link', 'label' => 'Button link', 'columns' => 12, 'choices' => array('none' => 'Choose a link to a post / page...') + piklist( get_posts( array( 'post_type' => Array('post','page'), 'orderby' => 'post_title', 'order' => 'ASC' ), 'objects' ), array( 'ID', 'post_title' ) ) ), array( 'type' => 'file', 'field' => 'link_thumb', 'scope' => 'post_meta', 'label' => 'Set thumbnail image', 'options' => array( 'modal_title' => 'Add link image', 'button' => 'Add' ), 'validate' => array( array( 'type' => 'image' ) ) ) ), 'conditions' => array( array( 'field' => 'flexible_content:module_select', 'value' => 'module_link' ) ) ), // Link array( 'type' => 'group', 'label' => '', 'field' => 'module_link', 'fields' => array( array( 'type' => 'text', 'field' => 'pdf_title', 'label' => 'Title', 'attributes' => array( 'class' => 'large-text' // WordPress css class ) ), array( 'type' => 'textarea', 'field' => 'pdf_text', 'label' => 'Text', 'attributes' => array( 'rows' => 2, 'class' => 'large-text' ) ), array( 'type' => 'file', 'field' => 'pdf_file', 'scope' => 'post_meta', 'label' => 'Choose file', 'options' => array( 'modal_title' => 'Add file', 'button' => 'Add' ), ), array( 'type' => 'file', 'field' => 'pdf_thumb', 'scope' => 'post_meta', 'label' => 'Set thumbnail image', 'options' => array( 'modal_title' => 'Add thumb', 'button' => 'Add' ), 'validate' => array( array( 'type' => 'image' ) ) ) ), 'conditions' => array( array( 'field' => 'flexible_content:module_select', 'value' => 'module_pdf' ) ) ) // PDF ) // end 'fields' )); -
March 12, 2018 at 5:03 pm #8783
-
March 12, 2018 at 5:25 pm #8784
juxtaParticipantThanks Steve, though I’ve just tried with the beta and it’s no different – still a massive lag whenever I add (or remove) a group. Any other ideas? Am I doing something particularly labour intensive for Piklist?
(Am basically trying to avoid ACF at all costs)
-
March 14, 2018 at 7:15 pm #8793
juxtaParticipantJust to add more detail, in case it helps diagnose… I’ve been experimenting further, removing elements and testing, and it appears that what is causing the slowdown (which increases with the number of repeated elements) is the conditionals – and the slowdown increases with the number of conditionals. I’ve for now removed these, and there’s no slowdown, but of course it can’t act as a flexible content block (a la ACF) if you can’t choose between sets of fields.
Anyway, it’s a great library, I’m enjoying using it – hopefully the conditionals issue can be fixed in a later release (if there isn’t already a way round it?)
-
March 23, 2018 at 1:38 pm #8799
friendlyfire3MemberI have this same issue (even with the beta). It’s been going on for a bit.
-
-
AuthorPosts
- You must be logged in to reply to this topic.