Hi!
I want to achieve this:
All textfields have an option called something like “translatble field”, if this is true i want to create a new textfield and append it to group field under the first field:
For example if the textfield “main-text” has the “translatable” option to “true” a second field need to be generated named “main-text_en”.
How can I create this second field on the fly?
at the moment i have this:
//creeate a radio input
add_action(‘acf/render_field_settings/type=text’, ‘add_radio_to_field’, 20);
function add_radio_to_field($field) {
acf_render_field_setting( $field, array(
‘label’ => __(‘Translatable ‘,’acf’),
‘type’ => ‘radio’,
‘choices’ => array(
0 => __(“No”,’acf’),
1 => __(“Yes”,’acf’)),
‘name’ => ‘translatable’,
));
}
// check if field has the value
function action_function_name( $field ) {
if ($field[“translatable”])
{
echo “field is translatable”;
}
}
add_action( ‘acf/render_field’, ‘action_function_name’, 10, 1 );