Relationship Field > List View input How customize the display more easily?
-
Hello,
I almost managed to customize the display of relationship field > List View input
based on this post found hereby chance by following the logic of the code and a little help from IA
I want to do the same thing but the informations is in a (property-feature) taxonomy and all the fields are pods (we stay in pods 100%)
I tested and I was able to display the IDs and term_description, but not my others fields image or another field (pods)
Before codeadd_filter(
'pods_field_pick_data',
function ($data, $name, $value, $options, $pod, $id) {
$relationship_field_name = 'p-feature'; // Replace with your actual relationship field name
$post_type = 'property'; // Replace with your CPT name
if (false !== strpos($name, $relationship_field_name)) {
foreach ($data as $id => &$label) {
$pod = pods($post_type, $id);
$feature_category = $pod->field('feature_category');
$feature_image_id = $pod->field('feature_image');
// Ensure feature image exists and is a valid image ID
if ($feature_image_id && wp_attachment_is_image($feature_image_id)) {
$feature_image_url = wp_get_attachment_url($feature_image_id);
// Check if image format is SVG (ensure proper MIME type check for SVG)
if (strpos(get_mime_type($feature_image_id), 'image/svg+xml') !== false) {
$feature_image_url .= '.svg'; // Append .svg if image is SVG
}
} else {
$feature_image_url = ''; // Set to empty string if not a valid image
}
$term = get_term($id); // Get term object using term ID
$term_description = $term->description; // Get term description
$label = sprintf(
'%s - %d - %s - %s - %s',
$label, // Term name (already set in $data)
$id,
$feature_category,
$feature_image_url,
$term_description // Add term description
);
}
}
return $data;
},
10,
6
);After code
as you can see I have not managed to display the images attached to my tax (svg),
how can I display or adjust them ?
if you have a solution to achieve this result please share itnote that pods cannot at the time I write this post differentiate between parent terms and child terms everything is offered in raw list,
if I have the possibility of reorganizing my lists by the bars I do not need the arrows
it overloads the content and confuses the end user we do not have control over that at the moment, you have to inject a css.pods-list-select-item__move-buttons {display: none!important;}
a possibility to deactivate the rerange for parent terms would be welcome or even deactivate them (gray display) maybe even hide them I let you imagine the disaster of changing the order of parent terms ??
- You must be logged in to reply to this topic.