SORRY for highjacking your thread.
Any change you could share a working demo of a custom implementation?
Currently i’m trying to see if i can make the following field working https://github.com/kevinruscoe/acf-star-rating-field/tree/master with acf’s conditional logic.
So i added the to the input.js
var star_field = acf.Field.extend({ type: 'star_rating_field' });
acf.registerFieldType(star_field);
acf.registerConditionForFieldType('equalTo', 'star_rating_field');
.
Now i’m able to select conditions in other fields and select that field. The only issue is the conditions are not working so i have the feeling i’m missing some code to make this to work. Any ideas?
Hi John,
Thanks for your extended feedback and your vision on the makes and models part. Basically this is already implemented as is as the case described above within a single taxonomy in a parent child construction.
I managed to change the text for the tooltip and title from the popup thanks to your valuable feedback. Much appreciated, thanks!
So i have only 1 thing to figure out and that is altering that parent selector field for the taxonomy.
I have been digging true the fields file at “acf/includes/fields/class-acf-field-taxonomy”.
So basically i need to be able to modify/extend the class “acf_field_taxonomy” / function “ajax_add_term” and change the behavior for field key X and Y.
I will have some sleep and see if i can come to somekind of solution 😀
if( is_taxonomy_hierarchical( $field['taxonomy'] ) ) {
$choices = array();
$response = $this->get_ajax_query($args);
if( $response ) {
foreach( $response['results'] as $v ) {
$choices[ $v['id'] ] = $v['text'];
}
}
acf_render_field_wrap(array(
'label' => __('Parent', 'acf'),
'name' => 'term_parent',
'type' => 'select',
'allow_null' => 1,
'ui' => 0,
'choices' => $choices
));
}
Solved issue 1
add_filter('acf/fields/taxonomy/result/key=field_605b7c5cc9dc9', 'my_acf_fields_taxonomy_result2', 10, 4);
function my_acf_fields_taxonomy_result( $text, $term, $field, $post_id ) {
$text = $term->name;
return $text;
}
Feedback and issue 2 remains for the feature save/create terms.
2.1) How to turn of the parent selector on specific field.
2.2) Change the name of the tooltip/dialog(modal) with label name instead of the taxonomy.
2.3) In the dialog(modal) replacing the label of parent with custom label name of a field to field basis.
Ideally the should be some unique identification for the modals
1) Screenshot issue 1.
2) Screenshot issue 2.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.