Cloneable group with MB Builder

Support MB Blocks Cloneable group with MB BuilderResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #17008
    anjaanja
    Participant

    Hi, i have a cloneable group with a cloneable singe_image field.
    I have no idea how to ouput it with mb blocks.

    Is that even possible and if so how?

    #17114
    epacepac
    Participant

    Hello
    I'm also intested in the way to clone a group of fields in mb blocks.
    I'm not sure if it is possible but it would be a great feature.
    Many thanks

    #17151
    epacepac
    Participant

    Hello Anja
    With the last version of mb blocks it is possible to clone a group.

    'fields' => [
    
            [
                'id' => 'thumbs',
                'type' => 'group',
                'clone'  => true,
                'sort_clone'  => true,
                'fields' => [
    
                    [
                        'name' => "Thumb",
                        'id' => 'thumb',
                        'type' => 'file_advanced'
                        ],
                    ],
            ],
    
        ],
    

    Kind regards

    #17207
    Anh TranAnh Tran
    Keymaster

    Hi Anja,

    In MB Builder, assuming you have something similar to this:

    https://i.imgur.com/8xKDkzJ.png

    And you have added a block to a post with the following content:

    https://i.imgur.com/FhbHQHn.png

    Then you can use this template code in the MB Builder to display the group:

    {% set products = mb.mb_get_block_field( 'products' ) %}
    {% for product in products %}
      <h4>{{ product.product_title }}</h4>
      {% for image_id in product.product_images %}
         {% set image_url = mb.wp_get_attachment_url( image_id ) %}
         <img src="{{ image_url }}">
      {% endfor %}
    {% endfor %}

    https://i.imgur.com/kMIPGrv.png

    Here is the result:

    https://i.imgur.com/PaIXpG4.png

    (sorry for big images)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.