Building a Drupal site from scratch - part 10 - Views exposed filters

| Drupal Development | 1 seen

<p>Remember at start of this tutorial <a href="http://reinisfischer.com/building-drupal-site-scratch-part-1-planing">we created a tour types taxonomy</a>, by allowing asign a category for each node from content type tour? Today we gonna add these values to our tours page, by allowing for users to filer tours by their type:</p><p>&nbsp;</p><p>Open your view tour, and under filter settings add filter Tour type:</p><p><img src="http://reinisfischer.com/sites/default/files/filtertours.JPG&quot; alt="" width="752" height="563"></p><p>Make sure you check next to Expose this filter. Save your view, now by accessing your view page, you should see something similiar to this:</p><p><img src="http://reinisfischer.com/sites/default/files/filtertourview.JPG&quot; alt="" width="826" height="514"></p><p>&nbsp;</p><p>Which is nice, and does his job as needed (filters on values entered)</p><p>Depending on your mood and needs, you can leave this, or you can expose this filter as seperate block. In part 6, I'm talking <a href="http://reinisfischer.com/building-drupal-site-scratch-part-6-working-bl… to configure blocks</a>. So by exposing this filter as block, we would have more control of it.</p><p>To expose filter as block - open Advanced tab on your page view, and look for <strong>Exposed form</strong>, change value from No, to Yes.</p><p><img src="http://reinisfischer.com/sites/default/files/exposedyes.JPG&quot; alt="" width="772" height="474"></p><p>&nbsp;</p><p>Save your view, and go to blocks page (structure/block)</p><p>New block called Exposed form: your name will show up in Disabled blocks section. Now you can put this block in which region you would like to. For this tutorial I'll put thi block on our Bootstrap subthemes Secondary (Right Sidebar) section.</p><p>Again, like in case when we putted Featured block to be visible jut on frontpage, we must limit viibilty of this block, to be visible just on the page, which it's related (tours)</p><p><img src="http://reinisfischer.com/sites/default/files/visibletours.JPG&quot; alt="" width="998" height="429"></p><p>Lets visit our page (tours) to see how it looks like:</p><p><img src="http://reinisfischer.com/sites/default/files/toursfiltered.JPG&quot; alt="" width="988" height="505"></p><p>&nbsp;</p><p>Nice, don't you agree?&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>

Add new comment