acf_admin_field_group::ajax_render_field_settings
This function will return HTML containing the field's settings based on it's new type
Method of the class: acf_admin_field_group{}
Hooks from the method
Returns
null. Nothing (null).
Usage
$acf_admin_field_group = new acf_admin_field_group(); $acf_admin_field_group->ajax_render_field_settings();
Changelog
| Since 5.0.0 | Introduced. |
acf_admin_field_group::ajax_render_field_settings() acf admin field group::ajax render field settings code ACF 6.0.4
public function ajax_render_field_settings() {
// Verify the current request.
if ( ! acf_verify_ajax() || ! acf_current_user_can_admin() ) {
wp_send_json_error();
}
// Make sure we have a field.
$field = acf_maybe_get_POST( 'field' );
if ( ! $field ) {
wp_send_json_error();
}
$field['prefix'] = acf_maybe_get_POST( 'prefix' );
$field = acf_get_valid_field( $field );
$tabs = array(
'general' => '',
'validation' => '',
'presentation' => '',
'conditional_logic' => '',
);
foreach ( $tabs as $tab => $content ) {
ob_start();
if ( 'general' === $tab ) {
// Back-compat for fields not using tab-specific hooks.
do_action( "acf/render_field_settings/type={$field['type']}", $field );
}
do_action( "acf/render_field_{$tab}_settings/type={$field['type']}", $field );
$sections[ $tab ] = ob_get_clean();
}
wp_send_json_success( $sections );
}