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

HTML element id given through ACF not passed to quick edit fields #168

Closed 355am closed 4 months ago

355am commented 8 months ago

I've added HTML element ids under "Wrapper Attributes" in ACF to some of my text fields, but those won't go through for the quick edit fields – although I believe in previous versions it worked.

Since I need those wrapper ids, I tried to hook into acf_qef_wrapper_attributes_{$field_type} ({$field_type} = 'text') filter to add them through the hook, but it seems to me that the hook does not fire.

Using 3.3.0 on WordPress 6.4.3.

Code in functions.php:

function add_wrapper_id_to_qef($wrapper_attr, $is_quickedit, $field) {
    $wrapper_attr['id'] = $field['wrapper']['id'];
    return $wrapper_attr;
}
add_filter('acf_qef_wrapper_attributes_text', 'add_wrapper_id_to_qef', 10, 3);
mcguffin commented 7 months ago

Hi, The id wouldn't be unique along the document, that's why I skipped it. (Fields occur two times in the DOM; one for quick edit, one for bulk. With QuickEdit active, there is even a third instance.) I'll be adding a data-id attribute to the field, that holds the id attribute from the field config.

FYI: The acf_qef_wrapper_attributes_text filter is only effective for generic (=non-default) fields.