mcguffin / acf-quickedit-fields

WordPress Plugin implementing Column Displaying, QuickEdit and BulkEdit for Advanced Custom Fields (ACF)
https://wordpress.org/plugins/acf-quickedit-fields/
GNU General Public License v3.0
359 stars 49 forks source link

Does this work with automatically added fields? #159

Closed UlrichThomasGabor closed 7 months ago

UlrichThomasGabor commented 10 months ago

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?

mcguffin commented 10 months ago

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

UlrichThomasGabor commented 10 months ago

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?