Download presentation
Presentation is loading. Please wait.
Published byIsaac Day Modified over 9 years ago
1
Wrapping Views around your fingers 1
2
2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of application software development. 2 years of Drupal development 2 years of Drupal development Assisting with D8 Migration in core Assisting with D8 Migration in core d.o. : densolis d.o. : densolis irc: #drupal-florida & # drupal-migrate: densolis irc: #drupal-florida & # drupal-migrate: densolis skype: densolis.aol.com skype: densolis.aol.com
3
Dennis Solis Born and raised in SF 3 Live in Cocoa, Florida
4
Views Topics TopicsModules Contextual Filterviews, ctools Relationshipentity entity reference entity connect Views Relationshipviews, ctools 4
5
Views If Time Topics TopicsModules Views conditionalviews_conditional Downloadviews_data_export 5
6
You are all experts in Contextual filters Relationships 6
7
What is a contextual filter? Basically a contextual filter is simply a way of limiting what information you displayed to the user. 7
8
Why? Help your users focus on items for which they are search. Limit what data the user see. 8
9
How could you possible be a CONTEXTUAL FILTER expert? 9
10
Contextual Filter 10
11
Contextual Filter 11
12
Contextual Filter 12
13
Contextual Filter 13
14
Contextual Filter Examples Courses on a restaurant’s menu Bad Camp sessions Airline reservations Filter by product types on Amazon or E-Bay 14
15
Contextual Filters Samples Restaurant MenuExample (2) Restaurant MenuExample (2) Sons of American Veterans Sons of American Veterans 15
16
Contextual Filters Samples Restaurant Menu (Example 1) Restaurant Menu (Example 1) Menu at a glance – show everything Menu at a glance – show everything Starters Starters Signature Appetizers Signature Appetizers Main Entrees Main Entrees Jack Daniel’s Grill Jack Daniel’s Grill Sour and Salads Sour and Salads 16
17
Contextual Filters Let’s examine the restaurant’s contextual filter Let’s examine the restaurant’s contextual filter (Example 2) (Example 2) 17
18
How could you possible be a RELATIONSHIP expert? 18
19
Relationships 19 Because of the relationship, you know some things about the other person.
20
What is a relationships? 20 Content Menu category Starters Appetizers Author’s Name User Image Content type (taxonomy)
21
Why? You want to maintain a single copy / instance of your data. Your web site reference the single copy / instance of your data. If you change the data, it is changed through out the web site. 21
22
Relationships Author / user create a content node An image is associated with a content node A taxonomy term associated with a content node Another entity associated with a content node 22
23
How do you create a relationship? Kind of like setting up a taxonomy entry. Remember, an entity references another entity! 1. 1. Setup a content type of Waiter / staff 2. 2. Setup a content type of menu dish 3. 3. On the Customer Order, we will “connect” the customer order to both the Waiter / staff and menu dish content types. 23
24
Relationships 24 CT – Staff CT - Menu section (Example 3 & 4)
25
Relationships 25 CT – Dishes CT – Staff CT - Menu section (Example 5)
26
Relationships 26 CT – Dishes CT – Staff CT – Customer Order CT - Menu section (Example 6)
27
Relationships 27 CT – Menu Item CT – Wait staff CT – Customer Order CT – Customer Survey CT - Menu section (Example 7)
28
Univ. of Hard Knocks Suggestions for Views Include node type in field name Easily find field in views list of fields. 28
29
Relationship Examples ) Display an customer order (Example 8) Restaurant customer order relationships: Waiter / staff Item order reference menu dish 29
30
Relationship / SQL View INNER JOIN: Returns all rows when there is at least one match in BOTH tables. Require relationship = Y LEFT JOIN: Return all rows from the left table, and the matched rows from the right table. Require relationship = N 30
31
Views Add relationships Views – Add relationship(Example 8) Referenced – Read entity referenced from source View is based upon Customer Order and reading Staff, and Dish information Referencing – Read source from entity reference View is based upon Staff and reading Customer Order information. 31
32
Download a table into a CSV file modules: views_data_export The module view data export will allow you to download your table view into a comma separated value (CSV) file. 32
33
Download a table into a CSV file Data export is exposed on your view 33 (Example 9)
34
Download a table into a CSV file Choose “Data Export” from the +Add in views Notice your Format is CSV File 34 (Example 10)
35
Download a table into a CSV file Setting The text “by deselection this, the xml file…” is a bit misleading. Need to check “Provide as file” if you want a download file! 35 You can put replacement patterns in the file name
36
Download a table into a CSV file Make sure you specify: A path I used _dnld Attach to – The view to attach the download. Batch export – Yes if big download Pager = Display all items 36
37
Views conditionals module: views_conditional module: views_conditional You want to check some condition before you decided to the field should be displayed.. In my case, I check a person’s role before decide if they have the permissions to see a specific field. Example Example 37
38
UHK Suggestions for Views Name content types in singular Name content types in singular Names views in plural Names views in plural If using multiple views: If using multiple views: “All displays” vs “this page” “All displays” vs “this page” Structure -> Views -> Settings Structure -> Views -> Settings Show the SQL query Show the SQL query Make input required BEFORE views runs. Make input required BEFORE views runs. 38
39
UHK Suggestions for Views Page views with same path. Page views with same path. Bad – only one view will appear in the menu Bad – only one view will appear in the menu Good – if the different views have different role permission, you can have multiple views under one menu item – and role appropriate view will appear. Good – if the different views have different role permission, you can have multiple views under one menu item – and role appropriate view will appear. With views aggregation – do not sort the data. Let the aggregation do it. With views aggregation – do not sort the data. Let the aggregation do it. Don’t forget to put in No Results message in your view. Don’t forget to put in No Results message in your view. 39
40
Make a table view “responsive” module: table trash module: table trash While we cannot make a table view truly responsive, this does the next best thing. When the table view is displayed on a tablet or a phone, table trash hides the required number of columns so that the report will fit on the device. To expand the report the user can then click on the plus next to the line in which they are interested. 40
41
Congratulation! You are now an Advance Views builder! 41
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.