We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33238
    • 388 Posts
    Quote from: Bruno17 at Jul 12, 2017, 02:33 PM
    did you see this one?
    https://docs.modx.com/extras/revo/migx/migx.tutorials/migx.varying-layout-boxes/migx.varying-layout-boxes.configurator-version

    you would have one configuration for each content-type and select them at the main-configuration in the multiple-formtabs field.
    This will create a listbox, which lets the customer switch between the different forms.

    Make sure, you have all unused fields of the other forms as hidden fields. Otherwise allready existing values would get lost while switching between the different forms.

    Thid way. you also don't need all this conditionals in your tpl-chunks, which will slow everything down, but you would have a call like that:

    [[getImageList? &tpl=`@FIELD:MIGX_formname`&tvname=`MultiColumn`]]


    which would switch between tpl-chunks depending on the value of the automatically created field 'MIGX_formname'

    Bruno, thank you very much, I just move all the tabs into the MIGX.Varying layout-boxes.Configurator-Version and everything is working perfect.
    It was quite messy because there was many tabs with many fields, and takes time understand the system, but everything was sorted and it's quite easy.
    Really really appreciate your help smiley

    - Just one last quick question:

    Every window that you select with the dropdown menu has two tabs now, One general and the other one is specific for that window.
    that means all the options are sharing the general tab that has fields like, margin, title etc...

    The question is, in case I need make a change on the general tab I'll need go into every single MigX to make the same change, there is a way to put that General tab somewhere where any change will be in all the other MigX Windows?

    Hope that make sence.
    Thank you Bruno!
      --
      ysanmiguel.com
      • 4172
      • 5,888 Posts
      with version 2.11.0
      https://github.com/Bruno17/MIGX/blob/master/_packages/migx-2.11.0-pl.transport.zip

      you can have a beforecreateform - hooksnippet.

      Let's say, you have another MIGX - config with your base - formtabs with config-name of 'layout_base'

      Put into the MIGXdb-Settings tab under Hook - Snippets of your main-MIGX-config (where you have selected the multiple-formtabs), something like that:

      {"beforecreateform":"layouts_beforecreateform"}


      and create a snippet 'layouts_beforecreateform'

      with some code like that:

      if ($basic_config = $modx->getObject('migxConfig',array('name'=>'layout_base'))){
          
          $basic_tabs = json_decode($basic_config->get('formtabs'),1);
      
          //print_r($basic_tabs);
          
          if (is_array($tabs) && is_array($basic_tabs)){
              $new_tabs = array();
              foreach ($basic_tabs as $tab){
                  $new_tabs[] = $tab;
              }
              foreach ($tabs as $tab){
                  $new_tabs[] = $tab;
              }        
              $scriptProperties['tabs'] = $new_tabs;
          }
      }
      


      this will merge the tabs of your layout_base - config with the tabs of the currently selected formtabs.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!