Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Req: display custom text when query returns no result #191

Open
awrog opened this issue Aug 19, 2020 · 0 comments
Open

Req: display custom text when query returns no result #191

awrog opened this issue Aug 19, 2020 · 0 comments

Comments

@awrog
Copy link

awrog commented Aug 19, 2020

I'd like to be able to display a custom message when there is no search-result

Something like (simplesearch_results.html.twig)

{% if query %}
   {% set count = search_results ? search_results.count : 0 %}
   {% if count is same as( 0 ) %}
      {{ "PLUGIN_SIMPLESEARCH.SEARCH_NORESULTS"|t(query|e, count)|raw }}
   {% elseif count is same as( 1 ) %}
      {{ "PLUGIN_SIMPLESEARCH.SEARCH_RESULTS_SUMMARY_SINGULAR"|t(query|e)|raw }}
   {% else %}
      {{ "PLUGIN_SIMPLESEARCH.SEARCH_RESULTS_SUMMARY_PLURAL"|t(query|e, count)|raw }}
   {% endif %}
% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant