Open
Description
I have a custom ACF field that represents a MongoDB object. In the Admin Columns UI I can add the column for this field, but it renders as "Unsupported value format". I was looking for a hook that would let me manipulate this $value before it being rendered (like grabbing a Mongo object property), but couldn't find a way.
It would be very helpful if the Unsupported column class would filter the value before returning.. something like this:
class Unsupported extends Column {
public function get_value( $id ) {
$value = get_field( $this->get_meta_key(), $id );
// new filter to try and parse the unsupported value before giving up with the "unsupported format" message
$value = apply_filters( 'ac/column/unsupported_value', $value, $id, $this );
return is_scalar( $value ) ? (string) $value : __( 'Unsupported value format', 'codepress-admin-columns' );
}
...
}
Then, we could use it like this:
add_filter( 'ac/column/unsupported_value', function( $value, $id, $column ) {
if ($value instanceof \MongoDB\Model\BSONDocument) {
return $value->title;
}
return $value;
}, 10, 3 );
Any chance this change is included in the plugin?
Thanks.
Metadata
Metadata
Assignees
Labels
No labels