Quote from LuigiPulcini on September 15, 2023, 10:09
Hello,
At the moment, it appears that it is not possible to customize the content of a column for custom fields. In fact, while the woobe_extend_fields
filter allows developers to add custom fields, the wrap_field_val
method of the WOOBE
class doesn't have a filter that would allow developers to customize the output of each cell for the custom fields.
For example, by modifying the last line of the wrap_field_val
method from the current code:
return $res;
to
return apply_filters( 'woobe_wrap_field_val', $res, $post, $field_key, $product_type );
it would be possible to write a callback function such as:
add_filter( 'woobe_wrap_field_val', 'my_wrap_field_val', 10, 4 );
public function my_wrap_field_val( $res, $post, $field_key, $product_type ) {
if ( $field_key ==='my_custom_field' ) {
$data = my_function_to_collect_data( $post );
$res = WOOBE_HELPER::render_html(
'path/to/my/edit/view.php',
$data
);
}
return $res;
}
This proposed change would help integrate other plugins into your bulk editor in a more flexible way compared to simple meta keys.
I hope this helps.
Best,
Luigi.
Hello,
At the moment, it appears that it is not possible to customize the content of a column for custom fields. In fact, while the woobe_extend_fields
filter allows developers to add custom fields, the wrap_field_val
method of the WOOBE
class doesn't have a filter that would allow developers to customize the output of each cell for the custom fields.
For example, by modifying the last line of the wrap_field_val
method from the current code:
return $res;
to
return apply_filters( 'woobe_wrap_field_val', $res, $post, $field_key, $product_type );
it would be possible to write a callback function such as:
add_filter( 'woobe_wrap_field_val', 'my_wrap_field_val', 10, 4 );
public function my_wrap_field_val( $res, $post, $field_key, $product_type ) {
if ( $field_key ==='my_custom_field' ) {
$data = my_function_to_collect_data( $post );
$res = WOOBE_HELPER::render_html(
'path/to/my/edit/view.php',
$data
);
}
return $res;
}
This proposed change would help integrate other plugins into your bulk editor in a more flexible way compared to simple meta keys.
I hope this helps.
Best,
Luigi.