avalon23_fields_options_extend

This hook allows you to add additional settings for the filter element.

for example you added a custom element as described in this article  and you need to add a text field to display different text for different filters


add_filter('avalon23_fields_options_extend', function( $args ) {
if($args['field_key']=='my_example'){
$filter_id = intval($args['filter_id']);
$field_id = intval($args['field_id']);
if (isset($args['field_id'])) {
$field_id = intval($args['field_id']);
}
$key = 'my_example' . '-' . "text";
$val = avalon23()->filter->options->get_option($filter_id, 'my_example', $key);
$args['rows'][]= [
'pid' => 0,
'title' => esc_html__('Additional text', 'woocommerce-filter'),
'value' => AVALON23_HELPER::draw_html_item('input', [
'class' => 'avalon23-filter-field-option',
'type' => 'text',
'value' => $val === '' ? -1 : $val,
'data-table-id' => $filter_id,
'data-key' => $key,
'data-field-id' => $field_id
]),
'notes' => esc_html__('Add some text', 'woocommerce-filter'),
];
}
return $args;

}, 99);

In the settings of the custom element, you will see a text field:

to get this field:

 


$key = 'my_example' . '-' . "text";
$val = avalon23()->filter->options->get_option($filter_id, 'my_example', $key);

Add this text to display in custom filter item: