Skip to main content

Views exposed taxonomy exposed filter show "Content Taxonomy Tree" or "Taxonomy Term Reference Tree Widget" structure

Well Recently I came across the situation that the View exposed taxonomy field should show like "Content Taxonomy Tree" or "Taxonomy Term Reference Tree Widget . It took quite sometime to figure out what to do. When i Figured it out i decide to write a little bit about it. Following steps will help you to achieve this. 


1) You need install the module Taxonomy Term Reference Tree Widget 

2) You should have the view with taxonomy field field as exposed.

3) Copy and paste the following code on your custom module. 



4) You should change the 

      YOUR_MODULE_NAME  to your custom module name 

     your-toxonomy-field to your exposed taxonomy field

     '#vocabulary' => taxonomy_vocabulary_load(3),  Instead '3' you should keep your vocabulary  ID.

Comments

  1. Is this for d7 or d8? Is there a d8 version - I'd love to get this working on my site. having trouble signing up, but my email is ddowell617@gmail.com

    ReplyDelete
  2. sorry - also is vocabulary ID the taxonomy vocabulary machine name?

    ReplyDelete

Post a Comment

Popular posts from this blog

How to configure Drupal7, varnish, authcache2 and ESI in Nginx server?

This is step by step procedure for, how to configure the authcache, varnih and ESI for the drupal7 project in NGINX erver. To configuring the Nginx Server use the procedure from document " http://www.geoffstratton.com/2014/03/nginx-php-fpm-apc-ssl-drupal/ " Well, make sure your nginx server is up and running. 1.Configuring the Authcache module.      Download the module from https://www.drupal.org/project/authcache    Enable only the authcache module    Go to admin/reports/status , then you can see the Authcache area is red and saying that there is no back end has been configured.   2.Configure Varnish on the back-end[nginx server].     Using the Following commands,       $ curl http://repo.varnish-cache.org/debian/GPG-key.txt | sudo apt-key add -     $ echo "deb http://repo.varnish-cache.org/ubuntu/ precise varnish-3.0" | sudo tee -a /etc/apt/sources.list     $ sudo apt-get update ...

Drush php in Acquia Cloud Site factory

Recently I ran into a situation where I need to add some conditions in Acquia Cloud Site Factory, factory - hooks to find out the ACSF site name. To evaluate those lines of code, I need to use Drush php  https://drushcommands.com/drush-8x/core/core-cli/ How to get the ACSF site name ? $ drush php --uri=site1.example.acsitefactory.com >>> global $_acsf_site_name >>> echo $_acsf_site_name site1⏎

How to create the Popup or modal in Drupal 8?

The following code will help you to create the popup in Drupal 8.  use \ Drupal \ Core \ Ajax ; function testingPopup () { $response = new AjaxResponse (); $title = $this -> t ( 'Title for the Popup.' ); $form [ '#attached' ][ 'library' ][] = 'core/drupal.dialog.ajax' ; $response -> setAttachments ( $form [ '#attached' ]); $content = '<div class="test-popup-content">' . 'Content in HTML format' . '</div>' ; $options = array ( 'dialogClass' => 'popup-dialog-class' , 'width' => '75%' , ); $modal = new OpenModalDialogCommand ( $title , $content , $options ); $response -> addCommand ( $modal ); return $response ; } You can call the function testingPopup() , you will get the popup.