acf-quickedit-fields icon indicating copy to clipboard operation
acf-quickedit-fields copied to clipboard

Does this work with automatically added fields?

Open UlrichThomasGabor opened this issue 2 years ago • 2 comments

Hi

Does this somehow work with fields added via PHP, i.e. acf_add_local_field?

I tried setting the options like that, but nothing happens:

acf_add_local_field_group(
    [
        'key' => 'group_test',
        'title' => 'test',
        'fields' => [
            [
                'key' => 'test',
                'name' => 'test',
                'label' => 'test,
                'type' => 'text',

                'column' => true,
                'quickedit' => true,
            ],
        ],
    ],
);

Or is it necessary to bind a filter to acf_quick_edit_fields_types?

UlrichThomasGabor avatar Nov 24 '23 15:11 UlrichThomasGabor

It works, if you use the proper array keys. There are some examples in test/acf-json/: https://github.com/mcguffin/acf-quickedit-fields/blob/4ec0aeaab208978db6962a43a883043b7d17bbae/test/acf-json/group_acf_qef_basic.json#L24-L29

mcguffin avatar Nov 24 '23 15:11 mcguffin

Ok, thanks!

I noticed that additionally it is picky regarding the truth values.

This one does not work:

acf_add_local_field_group(
    [
        'key' => 'group_global_quickedit_test',
        'title' => 'QuickEdit-Test',
        'fields' => [
            [
                'key' => 'quickedit-test',
                'name' => 'quickedit-test',
                'label' => 'quickedit-test',
                'type' => 'text',

                'show_column' => true,
                'show_column_sortable' => true,
                'show_column_weight' => 1010,
                'allow_quickedit' => true,
                'allow_bulkedit' => true,
                'allow_backendsearch' => true,
            ],
        ],
        'location' => [
            [
                [
                    'param' => 'post_type',
                    'operator' => '==',
                    'value' => 'page',
                ],
            ],
        ],
        'menu_order' => 0,
    ],
);

This works:

acf_add_local_field_group(
    [
        'key' => 'group_global_quickedit_test',
        'title' => 'QuickEdit-Test',
        'fields' => [
            [
                'key' => 'quickedit-test',
                'name' => 'quickedit-test',
                'label' => 'quickedit-test',
                'type' => 'text',

                'show_column' => 1,
                'show_column_sortable' => 1,
                'show_column_weight' => 1010,
                'allow_quickedit' => 1,
                'allow_bulkedit' => 1,
                'allow_backendsearch' => 1,
            ],
        ],
        'location' => [
            [
                [
                    'param' => 'post_type',
                    'operator' => '==',
                    'value' => 'page',
                ],
            ],
        ],
        'menu_order' => 0,
    ],
);

Would maybe be good to add some documentation for that?

UlrichThomasGabor avatar Nov 24 '23 15:11 UlrichThomasGabor