Search_form destroys website

Hello,

On every page where is have: {!! get_search_form(false) !!} the page is broken and i get an fatel error:

Fatal error : Uncaught InvalidArgumentException: View [partials.searchform] not found. in C:\applications\groot-kormelink-optiek\web\app\themes\sage\vendor\illuminate\view\FileViewFinder.php:137 Stack trace: #0 C:\applications\groot-kormelink-optiek\web\app\themes\sage\vendor\illuminate\view\FileViewFinder.php(79): Illuminate\View\FileViewFinder->findInPaths(‘partials.search…’, Array) #1 C:\applications\groot-kormelink-optiek\web\app\themes\sage\vendor\illuminate\view\Factory.php(128): Illuminate\View\FileViewFinder->find(‘partials.search…’) #2 [internal function]: Illuminate\View\Factory->make(‘partials.search…’, Array, Array) #3 C:\applications\groot-kormelink-optiek\web\app\themes\sage\vendor\roots\sage-lib\Template\Blade.php(138): call_user_func_array(Array, Array) #4 C:\applications\groot-kormelink-optiek\web\app\themes\sage\vendor\roots\sage-lib\Template\Blade.php(58): Roots\Sage\Template\Blade->__call(‘make’, Array) #5 C:\applications\groot-kormelink-optiek\web\app\themes\sage\app\helpers.php(59): Roots\Sage\T in C:\applications\groot-kormelink-optiek\web\app\themes\sage\vendor\illuminate\view\FileViewFinder.php on line 137

What am i doing wrong?

Thanks for your time.
Koen

Oke, i had no searchform.blade.php, added this but still its not working correctly

searchform.blade.php:

<form role="search" method="get" class="search-form" action="{{ $sf_action }}">
   <label>
       <span class="screen-reader-text">{{ $sf_screen_reader_text }}</span>
       <input type="search" class="search-field" placeholder="{!! $sf_placeholder !!}" value="{{ $sf_current_query }}" name="s">
   </label>
   <input type="submit" class="search-submit" value="{{ $sf_submit_text }}">
</form>

filters.php:

/**
 * 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 &hellip;', 'placeholder', 'sage'),
        'sf_current_query' => get_search_query(),
        'sf_submit_text' => esc_attr_x('Search', 'submit button', 'sage'),
    ];
});

See image in attachment for next error.

Thanks for your time.

Hey @koentjuh1 - you’re probably running into this issue: https://github.com/roots/sage/issues/2105

You can try the solution in my comment on that issue as an immediate fix (replace the current get_search_form filter in filters.php).

Let me know if that doesn’t do it for you.

1 Like

Hey @mmirus,

Thanx for the solution, it works! :muscle:

1 Like