Hello, I have some misunderstanding about passing data to the view with the basic way not with Controller, so first what is “$class” refer to? and how to pass data to the specific page in this way?
and what this code should do?
/**
* Collect data for searchform.
*/
add_filter('sage/template/app/data', function ($data) {
return $data + [
'sf_action' => esc_url(home_url('/')),
'sf_screen_reader_text' => _x('Search for:', 'label', 'sage'),
'sf_placeholder' => esc_attr_x('Search …', 'placeholder', 'sage'),
'sf_current_query' => get_search_query(),
'sf_submit_text' => esc_attr_x('Search', 'submit button', 'sage'),
];
});
as we expect this data passing to the searchForm page? but it does not do this, it’s show error in the page Undefined variable: sf_current_query