Drupal モジュール Better Exposed Filters の導入から使用例まで

pericles
Drupalの Better Exposed Filters モジュール使用例です。

The Better Exposed Filters module replaces the Views’ default single- or multi-select boxes with radio buttons or checkboxes, respectively. Description fields and Select All/None links can be added to exposed filters to make for a better user experience.
Better Exposed Filters | Drupal.org

Better Exposed Filters

■Develモジュールによるテストデータ作成

・ダミーデータ作成などに使うDevelモジュールをインストール
$ cd /var/www/d7dev/
$ sudo drush dl devel
$ drush en devel devel_generate

・テストデータ作成
Home » Administration » Configuration » Development – Generate content
Content type ->すべてにチェック
How many nodes would you like to generate? -> 50
Maximum number of comments per node. -> 5
Add an url alias for each node. -> tick
Generate 押下

■Better exposed filters

・Better exposed filtersモジュールおよび関連モジュールインストール
$ cd /var/www/d7dev/
$ sudo drush dl views ctools better_exposed_filters
$ drush en views views_ui ctools better_exposed_filters
インストールモジュール確認
$ drush pm-list –type=Module –status=enabled

・VIEW作成
Home » Administration » Structure -> Views -> Add new view
View name: filtersTest
Display format : Table
Create a menu link : tick, Main menu

・VIEW詳細設定
– Fields
Add -> Content: Body, Content: Image, Content: Type
Content: Body (Body) -> Rewrite results -> Trim this field to a maximum length: tick, Maximum length : 255
Configure field: Content: Image -> Image style: Thumbnail

– Filter criteria
Add -> Content: Title, Content: Type
Configure filter criterion: Content: Title
Expose this filter to visitors, to allow them to change it : tick
Operator -> Contains
Configure filter criterion: Content: Type
Expose this filter to visitors, to allow them to change it : tick
Allow multiple selections : tick

– Advanced
Exposed form style: Basic -> Better Exposed Filters
Page: Exposed form options
Autosubmit : tick
Display “type” (Filter label: “Type”) exposed filter as : Checkboxes/Radio Buttons
More options for “type” (Filter label: “Type”) -> Add select all/none links : tick
More options for “type” (Filter label: “Type”) -> Make this filter collapsible : tick
「Save」忘れずに。


https://matome.naver.jp/odai/2139446126523398701/2139450455643968103

関連リンク

https://matome.naver.jp/odai/2139446126523398701
2014年03月16日