0

I already created a search view like /search it is giving form and results finely but Views UI is disabled in my server . So i want to split this search page into

1) A block which contains a search form

2) A block which will show appropriate results with form field data.

I created a TWIG file to display form and results on same page as search.html.twig

It is displaying form finely but not displaying any results. Can anybody suggest what i am wrong here?

{%
  set classes = [
    'view',
    css_name|clean_class,
    view.current_display|clean_class
  ]
%}

<div{{ attributes.addClass(classes) }}>
<h1>Sitewide Search</h1>
{{ title_prefix }}
{{ title }}
{{ title_suffix }}

 <div class="search-page-options">
  {{ drupal_entity('block', 'exposedformacquia_searchpage_2', check_access=false) }}
 </div>

 {% if pager %}
   <div class="view-header">
     {{ header }}
   </div>
   <div class="top-pager">{{ pager }}</div>
 {% endif %}

 {% if rows %}
   <h2 class="result-header">Search Results</h2>
   <div class="view-content">
     {{ rows }}
   </div>
 {% endif %}

 {% if empty %}
   <div class="view-empty">
     {{ empty }}
   </div>
 {% endif %}

 {% if pager %}
    {% if footer %}
   <div class="view-footer">
     {{ footer }}
   </div>
 {% endif %}

 <div class="bottom-pager">{{ pager }}</div>
  {% endif %}

</div>
3
  • Can i create a page or page template for this? Commented Nov 21, 2019 at 6:40
  • yea, just use page--search.html.twig
    – No Sssweat
    Commented Nov 21, 2019 at 6:44
  • But problem is view already displaying search form again. How can i disable it from view search? Commented Nov 21, 2019 at 7:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.