Tagged: 

Viewing 3 reply threads
  • Author
    Posts
    • #8287
      stefano
      Participant

      Hi Guys i’m trying to create a sort of custom page builder,
      i have a Group with a select box and a series of groups shown depending on that select value.

      Unfortunately after 5 or 6 module added the browser start to be very slow in adding new modules (minutes)

      I tried to search in the forum without luck

      I tried also commenting
      add_filter('get_meta_sql', array('piklist_wordpress', 'get_meta_sql'), 101, 6);

      as mentioned here:

      performance drop with lots of conditional statements

      But no effect…

      Here the code:

      
      piklist('field', array(
            'type' => 'group'
            ,'field' => 'module_group'
            ,'label' => 'Page Modules'
            ,'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'
                    ,'full_w_slide' => 'Full Width Slide'
                    ,'slide_text_dx' => 'Slide + Testo a DX'
                    ,'slide_text_sx' => 'Testo a SX + Slide'
                    ,'3_column_text' => 'Testo 3 Colonne'
                    ,'quadreria_img' => 'Quadreria Immagini'
                    ,'quadreria_img_irreg' => 'Quadreria Immagini Irregolare'
                    )
                )
              //----------------------
              //-- Full Width Slide --
              //----------------------
              ,array(
                'type' => 'group'
                ,'field' => 'full_w_slide_field'
                //,'label' => __('Slide + Testo a DX', 'mph')
                ,'list' => false
                ,'description' => __('A grouped field with a key set. Data is not searchable, since it is saved in an array.', 'piklist-demo')
                ,'fields' => array(
                    array(
                        'type' => 'text',
                        'field' => 'titolo',
                        'label' => 'Titolo (h2)',
                        'attributes' => array(
                        'class' => 'large-text' // WordPress css class 
                        )
                    )
                    ,array(
                        'type' => 'file'
                        ,'field' => 'upload_media'
                        ,'label' => 'Add File(s)'
                        ,'description' => 'This is the media uploader'
                        ,'options' => array(
                        'modal_title' => 'Add File(s)'
                        ,'button' => 'Add'
                        )
                    )
                )
                ,'conditions' => array(
                  array(
                    'field' => 'module_group:module_select'
                    ,'value' => 'full_w_slide'
                  )
                )
            )
      
              //----------------------
              //- Slide + Testo a DX -
              //----------------------
              ,array(
                'type' => 'group'
                ,'field' => 'slide_text_dx_field'
                //,'label' => __('Slide + Testo a DX', 'mph')
                ,'list' => false
                ,'description' => __('A grouped field with a key set. Data is not searchable, since it is saved in an array.', 'piklist-demo')
                ,'fields' => array(
                    array(
                        'type' => 'text',
                        'field' => 'titolo',
                        'label' => 'Titolo (h2)',
                        'attributes' => array(
                        'class' => 'large-text' // WordPress css class 
                        )
                    )
                    ,array(
                        'type' => 'text',
                        'field' => 'titolo',
                        'label' => 'Titolo (h3)',
                        'columns' => '6',
                        'attributes' => array(
                        'class' => 'large-text' // WordPress css class 
                        )
                    )
                    ,array(
                        'type' => 'file'
                        ,'field' => 'upload_media'
                        ,'label' => 'Add File(s)'
                        ,'description' => 'This is the media uploader'
                        ,'columns' => '6'
                        ,'options' => array(
                        'modal_title' => 'Add File(s)'
                        ,'button' => 'Add'
                        )
                    )
                    ,array(
                        'type' => 'editor',
                        'field' => 'my_textarea',
                        'label' => 'Text Area',
                        'columns' => '6',
                        'attributes' => array(
                            'rows' => 10,
                            'cols' => 50,
                            'class' => 'alignright'
                        )
      
                      )
                    )
                  ,'conditions' => array(
              array(
                'field' => 'module_group:module_select'
                ,'value' => 'slide_text_dx'
              )
            )
          )
      
              //----------------------
              //- Testo a SX + Slide -
              //----------------------
              ,array(
                'type' => 'group'
                ,'field' => 'slide_text_sx_field'
                //,'label' => __('Testo a SX + Slide', 'mph')
                ,'list' => false
                ,'description' => __('A grouped field with a key set. Data is not searchable, since it is saved in an array.', 'piklist-demo')
                ,'fields' => array(
                    array(
                        'type' => 'text',
                        'field' => 'titolo',
                        'label' => 'Titolo (h2)',
                        'columns' => '6',
                        'attributes' => array(
                        'class' => 'large-text' // WordPress css class 
                        )
                    )
                    ,array(
                        'type' => 'text',
                        'field' => 'titolo',
                        'label' => 'Titolo (h3)',
                        'columns' => '6',
                        'attributes' => array(
                        'class' => 'large-text' // WordPress css class 
                        )
                    )
                    ,array(
                        'type' => 'file'
                        ,'field' => 'upload_media'
                        ,'label' => 'Add File(s)'
                        ,'description' => 'This is the media uploader'
                        ,'columns' => '6'
                        ,'options' => array(
                        'modal_title' => 'Add File(s)'
                        ,'button' => 'Add'
                        )
                    )
                    ,array(
                        'type' => 'editor',
                        'field' => 'my_textarea',
                        'label' => 'Text Area',
                        'columns' => '6',
                        'attributes' => array(
                            'rows' => 10,
                            'cols' => 50,
                            'class' => 'alignright'
                        )
                    )
                    
                )
                ,'conditions' => array(
                  array(
                    'field' => 'module_group:module_select'
                    ,'value' => 'slide_text_sx'
                  )
                )
            )
      
              //----------------------
              //--- 3 Column Text ----
              //----------------------
              ,array(
                'type' => 'group'
                ,'field' => '3_column_text_field'
                //,'label' => __('Slide + Testo a DX', 'mph')
                ,'list' => false
                ,'description' => __('A grouped field with a key set. Data is not searchable, since it is saved in an array.', 'piklist-demo')
                ,'fields' => array(
                    array(
                        'type' => 'text',
                        'field' => 'titolo',
                        'label' => 'Titolo (h2)',
                        'attributes' => array(
                          'class' => 'large-text' // WordPress css class 
                        )
                    )
                    ,array(
                        'type' => 'text',
                        'field' => 'titolo_col_1',
                        'label' => 'Titolo Colonna 1 (h3)',
                        'columns' => 4,
                        'attributes' => array(
                        'class' => 'large-text' // WordPress css class 
                        )
                    )
                    ,array(
                        'type' => 'text',
                        'field' => 'titolo_col_2',
                        'label' => 'Titolo Colonna 2 (h3)',
                        'columns' => 4,
                        'attributes' => array(
                        'class' => 'large-text' // WordPress css class 
                        )
                    )
                    ,array(
                        'type' => 'text',
                        'field' => 'titolo_col_3',
                        'label' => 'Titolo Colonna 3 (h3)',
                        'columns' => 4,
                        'attributes' => array(
                        'class' => 'large-text' // WordPress css class 
                        )
                    )
                    ,array(
                        'type' => 'editor',
                        'field' => 'testo_col_1',
                        'label' => 'Testo Colonna 1',
                        'columns' => 4,
                        'attributes' => array(
                            'rows' => 7,
                            'cols' => 50,
                            'class' => 'large-text'
                        )
                    )
                    ,array(
                        'type' => 'editor',
                        'field' => 'testo_col_2',
                        'label' => 'Testo Colonna 2',
                        'columns' => 4,
                        'attributes' => array(
                            'rows' => 7,
                            'cols' => 50,
                            'class' => 'large-text'
                        )
                    )
                    ,array(
                        'type' => 'editor',
                        'field' => 'testo_col_3',
                        'label' => 'Testo Colonna 3',
                        'columns' => 4,
                        'attributes' => array(
                            'rows' => 7,
                            'cols' => 50,
                            'class' => 'large-text'
                        )
                    )
                )
                ,'conditions' => array(
                  array(
                    'field' => 'module_group:module_select'
                    ,'value' => '3_column_text'
                  )
                )
            )
      
              //----------------------
              //-- Quadreria Immagini --
              //----------------------
              ,array(
                'type' => 'group'
                ,'field' => 'quadreria_img_field'
                //,'label' => __('Slide + Testo a DX', 'mph')
                ,'list' => false
                ,'description' => __('A grouped field with a key set. Data is not searchable, since it is saved in an array.', 'piklist-demo')
                ,'fields' => array(
                    array(
                        'type' => 'text',
                        'field' => 'titolo',
                        'label' => 'Titolo (h2)',
                        'attributes' => array(
                        'class' => 'large-text' // WordPress css class 
                        )
                    )
                    ,array(
                        'type' => 'file'
                        ,'field' => 'upload_media'
                        ,'label' => 'Add File(s)'
                        ,'description' => 'This is the media uploader'
                        ,'options' => array(
                        'modal_title' => 'Add File(s)'
                        ,'button' => 'Add'
                        )
                    )
                )
                ,'conditions' => array(
                  array(
                    'field' => 'module_group:module_select'
                    ,'value' => 'quadreria_img'
                  )
                )
            )
      
              //----------------------
              //-- Quadreria Immagini Irregolare --
              //----------------------
              ,array(
                'type' => 'group'
                ,'field' => 'quadreria_img_irreg_field'
                //,'label' => __('Slide + Testo a DX', 'mph')
                ,'list' => false
                ,'description' => __('A grouped field with a key set. Data is not searchable, since it is saved in an array.', 'piklist-demo')
                ,'fields' => array(
                    array(
                        'type' => 'text',
                        'field' => 'titolo',
                        'label' => 'Titolo (h2)',
                        'attributes' => array(
                        'class' => 'large-text' // WordPress css class 
                        )
                    )
                    ,array(
                        'type' => 'file'
                        ,'field' => 'upload_media'
                        ,'label' => 'Add File(s)'
                        ,'description' => 'This is the media uploader'
                        ,'options' => array(
                        'modal_title' => 'Add File(s)'
                        ,'button' => 'Add'
                        )
                    )
                )
                ,'conditions' => array(
                  array(
                    'field' => 'module_group:module_select'
                    ,'value' => 'quadreria_img_irreg'
                  )
                )
            )
      
          )
        )
      );
      

      Some tips to improve or optimize?
      I have to change approach?

      Thanks`

    • #8293
      Steve
      Keymaster

      Unfortunately, you will have to change your approach. Maybe break them up into different fields… use Workflow tabs to break them up…

    • #8305
      friendlyfire3
      Participant

      I’m having this same issue. Unfortunately, the way we are using the groups with addmores predicates them being grouped so we can’t separate them into multiple tabs/workflows.

      Any suggestions on how to speed things up? I’m getting load times in the 5-6 minute range. Yikes!

    • #8306
      stefano
      Participant

      I personally decided to not use piklist to create a page builder ( still using it, but just for meta field management ), to achieve this kind of functionalities probably a js rewrite with this goal in mind is needed.

Viewing 3 reply threads
  • The topic ‘Add More and Conditional Slow Performance’ is closed to new replies.