• J
    johnnymoped

    After further investigation I found the line that is causing the problem.

    If I remove the following line from grinder.app.min.js it works correctly (emptyCmb2Inputs() function):
    n.find(".cmb-remove-group-row").click(), n.find(".cmb-remove-row-button").click();

    But of course this leads to other problems like causing the whole app to crash when trying to re-edit the same element.

    So, could you please have a look at your code to fix this.
    Would really appreciate it.

    Thanks,

    d.

    posted in General Discussion read more
  • J
    johnnymoped

    Hi,

    it's great that group field types are finally working.
    But there still seems to be a bug.
    Let's say I have an image field inside a group field.
    When adding a new group item and selecting the image for the new item only the image of the first item get's set/replaced.
    This clearly is a bug within laygridder as this works correctly when using the group field as a normal meta box (e.g. on a page).

    You can use this code to try it out:

        add_action('cmb2_admin_init', function(){
    
            $cmb = new_cmb2_box([
                'id' => 'cmb_repeater_metabox',
                'title' => 'Repeateable groups',
            ]);
    
            $groups = $cmb->add_field([
                'id' => 'cmb_groups',
                'type' => 'group',
                'options' => [
                    'group_title' => 'Entry {#}',
                    'add_button' => 'Add another entry',
                    'remove_button' => 'Remove entry',
                    'sortable' => true,
                ],
            ]);
    
            $cmb->add_group_field(
                $groups,
                [
                    'id' => 'cmb_groups_image',
                    'name' => 'Image',
                    'type' => 'file',
                ]
            );
    
            $cmb->add_group_field(
                $groups,
                [
                    'id' => 'cmb_groups_text',
                    'name' => 'Text',
                    'type' => 'textarea_small'
                ]
            );
    
        });
    
        add_filter('lg_cmb2_modals', function ($metaboxFormIds) {
            $metaboxFormIds[] = 'cmb_repeater_metabox';
    
            return $metaboxFormIds;
        });

    posted in General Discussion read more
  • J
    johnnymoped

    Hi,
    I am wondering why it is not possible to add a link to an image.
    Maybe I'm just missing something, but what's the point of having only an image.
    90% of the use case would probably also need a link (e.g. teaser image for a category page etc.).

    As I am now trying to add a custom element for this case I would need the image width and height to add the correct preview size/ratio in the grid. Is it possible to get this from the cmb2 file field? (via the javascript view).
    (the only workaround would be to make a synchronous Ajax call based on the image id to get all the image info from Wordpress).

    Thank you,

    daniel

    posted in General Discussion read more
  • J
    johnnymoped

    Hi,
    I'm also having the same problem.
    cmb2 has support for repeatable groups but this seems not be reflected in the gridder js code.

    To test this issue just use this code for a basic repeatable group (containing text and an image):

    https://gist.github.com/danielvonmitschke/8bc0fe942ef3df26db5f571cb2bd69ac

    best,

    daniel

    posted in General Discussion read more