ID); // add clone $fields[] = apply_filters('acf/load_field_defaults', array( 'key' => 'field_clone', 'label' => __("New Field",'acf'), 'name' => 'new_field', 'type' => 'text', )); // get name of all fields for use in field type drop down $field_types = apply_filters('acf/registered_fields', array()); // helper function function field_type_exists( $name ) { global $field_types; foreach( $field_types as $category ) { if( isset( $category[ $name ] ) ) { return $category[ $name ]; } } return false; } // conditional logic dummy data $conditional_logic_rule = array( 'field' => '', 'operator' => '==', 'value' => '' ); $error_field_type = '' . __('Error', 'acf') . ' ' . __('Field type does not exist', 'acf'); ?>
'text', 'name' => 'fields[' .$fake_name . '][label]', 'value' => $field['label'], 'class' => 'label', )); ?> | |||||
'text', 'name' => 'fields[' .$fake_name . '][name]', 'value' => $field['name'], 'class' => 'name', )); ?> | |||||
'select', 'name' => 'fields[' .$fake_name . '][type]', 'value' => $field['type'], 'choices' => $field_types, )); ?> | |||||
'textarea', 'name' => 'fields[' .$fake_name . '][instructions]', 'value' => $field['instructions'], 'rows' => 6 )); ?> | |||||
'radio', 'name' => 'fields[' .$fake_name . '][required]', 'value' => $field['required'], 'choices' => array( 1 => __("Yes",'acf'), 0 => __("No",'acf'), ), 'layout' => 'horizontal', )); ?> | |||||
'radio',
'name' => 'fields['.$field['key'].'][conditional_logic][status]',
'value' => $field['conditional_logic']['status'],
'choices' => array(
1 => __("Yes",'acf'),
0 => __("No",'acf'),
),
'layout' => 'horizontal',
));
// no rules?
if( ! $field['conditional_logic']['rules'] )
{
$field['conditional_logic']['rules'] = array(
array() // this will get merged with $conditional_logic_rule
);
}
?>
>
|
|||||