wrapping views around your fingers 1. 2 dennis solis solis media group solis media group over 20...
TRANSCRIPT
Wrapping Views Wrapping Views around your around your
fingersfingers
1
2
Dennis SolisDennis Solis
Solis Media GroupSolis Media Group Over 20 years of application software Over 20 years of application software
development.development. 2 years of Drupal development2 years of Drupal development Assisting with D8 Migration in coreAssisting with D8 Migration in core d.o. : densolisd.o. : densolis irc: #drupal-florida & # drupal-migrate: irc: #drupal-florida & # drupal-migrate:
densolisdensolis skype: densolis.aol.comskype: densolis.aol.com
ViewsViews
TopicsTopics ModulesContextual Filter views, ctoolsRelationship entity
entity reference entity connect
Views Relationship views, ctools
4
Views Views If TimeIf Time
TopicsTopics ModulesViews conditional
views_conditionalDownload views_data_export
5
You are all experts inYou are all experts in
Contextual filtersRelationships
6
What is a contextual filter?
Basically a contextual filter is simply a way of limiting what information you displayed to the user.
7
Why?
Help your users focus on items for which they are search.
Limit what data the user see.
8
How could you possible be a
CONTEXTUAL FILTER
expert?9
Contextual FilterContextual Filter
10
Contextual FilterContextual Filter
11
Contextual FilterContextual Filter
12
Contextual FilterContextual Filter
13
Contextual Filter Contextual Filter ExamplesExamples
Courses on a restaurant’s menu Bad Camp sessions Airline reservations Filter by product types on Amazon
or E-Bay
14
Contextual FiltersContextual FiltersSamplesSamples
Restaurant Menu Restaurant Menu (Example 1)(Example 1) Menu at a glance – show everythingMenu at a glance – show everything StartersStarters Signature AppetizersSignature Appetizers Main EntreesMain Entrees Jack Daniel’s GrillJack Daniel’s Grill Sour and SaladsSour and Salads
16
Contextual FiltersContextual Filters Let’s examine the restaurant’s Let’s examine the restaurant’s
contextual filtercontextual filter (Example 2)(Example 2)
17
How could you possible be a
RELATIONSHIP
expert?
18
RelationshipsRelationships
19
Because of the relationship, you know some things about the other person.
What is a relationships?What is a relationships?
20
Content
Menu category•Starters•Appetizers
Author’s NameUser
Image
Content type (taxonomy)
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
RelationshipsRelationships
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
How do you create arelationship?
Kind of like setting up a taxonomy entry. Remember, an entity references another
entity!
1. Setup a content type of Waiter / staff2. Setup a content type of menu dish3. On the Customer Order, we will “connect”
the customer order to both the Waiter / staff and menu dish content types.
23
RelationshipsRelationships
24
CT – Staff CT - Menu section
(Example 3 & 4)
RelationshipsRelationships
25
CT – Dishes
CT – Staff CT - Menu section
(Example 5)
RelationshipsRelationships
26
CT – Dishes
CT – Staff
CT – Customer Order
CT - Menu section
(Example 6)
RelationshipsRelationships
27
CT – Menu Item
CT – Wait staff
CT – Customer Order
CT – Customer Survey
CT - Menu section
(Example 7)
Univ. of Hard Knocks Univ. of Hard Knocks Suggestions for ViewsSuggestions for Views
Include node type in field name Easily find field in views list of fields.
28
Relationship ExamplesRelationship Examples
Display an customer order (Example 8))
Restaurant customer order relationships: Waiter / staff Item order reference menu dish
29
Relationship / SQL ViewRelationship / 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 = N30
ViewsViewsAdd relationshipsAdd 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
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
Download a table into a CSV file
Data export is exposed on your view
33
(Example 9)
Download a table into a CSV file
Choose “Data Export” from the +Add in views
Notice your Format is CSV File
34
(Example 10)
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
Download a table into a CSV file
Make sure you specify: A path
I used <view_path>_dnld Attach to – The view to
attach the download. Batch export – Yes if big
download Pager = Display all items
36
Views conditionals
module: views_conditionalmodule: 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..
ExampleExample37
UHK Suggestions for UHK Suggestions for ViewsViews
Name content types in singularName content types in singular Names views in pluralNames views in plural If using multiple views:If using multiple views:
““All displays” vs “this page”All displays” vs “this page” Structure -> Views -> SettingsStructure -> Views -> Settings
Show the SQL queryShow the SQL query Make input required BEFORE views Make input required BEFORE views
runs.runs.
38
UHK Suggestions for UHK Suggestions for ViewsViews
Page views with same path.Page views with same path. Bad – only one view will appear in the Bad – only one view will appear in the
menumenu Good – if the different views have Good – if the different views have
different role permission, you can have different role permission, you can have multiple views under one menu item – multiple views under one menu item – and role appropriate view will appear.and role appropriate view will appear.
With views aggregation – do not sort With views aggregation – do not sort the data. Let the aggregation do it.the data. Let the aggregation do it.
Don’t forget to put in No Results Don’t forget to put in No Results message in your view.message in your view. 39
Congratulation!Congratulation!
You are now an Advance Views builder!You are now an Advance Views builder!
41