The following code will add a checkbox in text fields and if you check read-only, it will become read-only for all users.
The same login will apply to Disabled.
add_action('acf/render_field_settings/type=text', 'add_readonly_and_disabled_to_text_field');
function add_readonly_and_disabled_to_text_field( $field ) {
acf_render_field_setting( $field, array(
'label' => __('Read Only?','acf'),
'instructions' => '',
'type' => 'true_false',
'name' => 'readonly',
));
acf_render_field_setting( $field, array(
'label' => __('Disabled?','acf'),
'instructions' => '',
'type' => 'true_false',
'name' => 'disabled',
));
}
add_filter('acf/prepare_field', 'filter_acf_prepare_field');
function filter_acf_prepare_field( $field ) {
if( !empty($field['readonly']) ){
$field['readonly'] = 1;
}
if( !empty($field['disabled']) ){
$field['disabled'] = 1;
}
return $field;
}