Views Mini-Course, Part II: Creating Flexible Views with Drupal 7

Post on 13-May-2015

3.588 views 0 download

Tags:

Transcript of Views Mini-Course, Part II: Creating Flexible Views with Drupal 7

Drupal 7 - Building flexible views!

acquia.comWednesday, May 8, 2013

Heather James Manager of Training at Acquia

HELLO!

@learningdrupal

@hjames

Wednesday, May 8, 2013

Acquia Training

http://training.acquia.comWednesday, May 8, 2013

Course materials

• Tested in hundreds of classrooms.

• Continuously updated.• Clear and easy follow, but

engaging content. • Blend of guided and

challenge exercises to test skills.

http://training.acquia.com/courses

The materials / handouts were very

comprehensive - personally I would not

change anything.

- O.G. Jan 2012

Wednesday, May 8, 2013

The trainers are partners

• Our trainers are experienced developers who love teaching.

• They provide subject matter expertise as well as well as passion for the topic.

• Partners are placed all over the globe.

http://training.acquia.com/testimonials

Lovely presenter, very patient and open to

questions. I feel a lot more confident to use

drupal myself and understand the

technical underpinnings.

- C.L., Sept 2012

Wednesday, May 8, 2013

• Popular packages are typical examples of the tailored packages we have delivered.

Tailored courses available

http://training.acquia.com/eventsWednesday, May 8, 2013

In todayʼs webinar!

• Viws mini course - May 2nd: Introduction to Views- May 8th: How to build flexible views < -- you are here- May 15th: Build your first module to back up your views!

• Drupal essentials- May 22nd: Drupal Essentials: How to Configure Accounts in Drupal

• Drupal for Project Managers mini-course- May 29th-June 19th: 4 weeks - Drupal for Project Managers!

Adam Boysen, Jakub Suchy, Amye Scavarda, Jenn Sramek

Wednesday, May 8, 2013

What weʼre doing today

• Building flexible views• Using relationships to expand selection• Using attachments• Using contextual filters• Best practices to finish your view

Wednesday, May 8, 2013

What you need to know already!

• How to add content• How to customize content types (add fields)• What modules are• How to install and configure modules

• From last week: How Views works, how to add a new View

Wednesday, May 8, 2013

BUILDING FLEXIBLE VIEWS

Finding your way around

Wednesday, May 8, 2013

Recap last class

Wednesday, May 8, 2013

Recap

• What do you want to select?

• Select base table to start (you can combine tables with relationships).

• Apply filters

• Select fields or “view mode”

• Where and how should it appear?

• Choose a format such as list, table, etc.

• Choose a display such as pages, blocks, RSS feeds. More displays available!

Wednesday, May 8, 2013

Step by step workflow

• 1. Choose what to query

• 2. Limit selection with filters and/or by fields

• 3. Select and configure formatting

• 4. Choose displays - and/or add attachments

Wednesday, May 8, 2013

Views is a query builder

• Click to create queries with Views.

• Filters to limit selection can be static or contextual.

• You can see the actual query written.

Wednesday, May 8, 2013

Views UI in detail

Wednesday, May 8, 2013

Views wizard

Page or blockDisplay settingsAdd to menu

Wednesday, May 8, 2013

Views wizard

Page or blockDisplay settingsAdd to menu

Wednesday, May 8, 2013

Views wizard

Page or blockDisplay settingsAdd to menu

Wednesday, May 8, 2013

Views editor

How to format & displayWhat to select & filter

Wednesday, May 8, 2013

Start by filtering selection

1

4

23

5

What to select & filter

Wednesday, May 8, 2013

How and where to display

1

23

5

4

6

How to format & display

Wednesday, May 8, 2013

Format and displayControlling display

Wednesday, May 8, 2013

Jump menu

Wednesday, May 8, 2013

Table formatting

• Customize labels - the column headers

• Make columns sortable

• Add links to edit for administrators

Wednesday, May 8, 2013

Be consistent

• Look at how things are done across your site

• Example: If adding admin views, follow order of fields in core Drupal

Wednesday, May 8, 2013

Frequent formatting?

Wednesday, May 8, 2013

Site wide formatting!

1

2

Wednesday, May 8, 2013

Think reusability!

Wednesday, May 8, 2013

View modes?

• Use the default view modes

• Display Suite - to create custom modes

• These are reusable, easier to manage across many views.

• Easier for theming!

Wednesday, May 8, 2013

Manage display

Web Page TitleGoogle

Teaser page

(thumbnail)

(thumbnail)

(thumbnail)

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia,

Lost luggage tips

Countries Vokalia and Consonantia, there live the blind texts. Separated they live.

What not to pack

Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language.

Luxury on a shoestring

http://example.com/articlesWeb Page Title

Google

Log in

name

password

Login

http://example.com/articles/lost

AdventurousBudget mindedFamiliesHigh !iers

For the traveler

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia. Separated they live in Bookmarksgrove right at the coast of Semantics, a large language ocean.

Who to contactThe airlineYour credit card companyTravel insurance

Lost luggage tips

(full article)

Full content

Example: Thumbnail in teaser Example: Full content image

Control “view modes”

Wednesday, May 8, 2013

Image styles available

• Add an image style

• Configure display on a content type

Wednesday, May 8, 2013

Think first

• Consistency!

• Reusability!

• Who can access it?

• What can they do?

Wednesday, May 8, 2013

Access control

Wednesday, May 8, 2013

Access restrictions

• By permission is easier to manage in future

Wednesday, May 8, 2013

Filters

Wednesday, May 8, 2013

Filters

• Expose filters to users

• Use permissions on a view

Wednesday, May 8, 2013

Demo: Exposed filter

• Review existing view: Content by user

• Expose filter to viewers (add another)

• Insert an edit link for admins

• Change access control of View

• Path: /admin/content/user

Wednesday, May 8, 2013

Pagers

Wednesday, May 8, 2013

Pagers

• Decide if you need pagers.

• Use Ajax loading for sidebars (demo)

Wednesday, May 8, 2013

Inifite scroll?

• Views Infinite Scrollhttp://drupal.org/project/views_infinite_scroll

Wednesday, May 8, 2013

Attachments

Wednesday, May 8, 2013

Views attachments

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean.

Best in Beppu

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean.

Paris excursions

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean.

Mali music

Articles

Adventurous appetites?Budget minded plansOutdoorsy typesAirlines competing for new customers

Wednesday, May 8, 2013

Demo

• Look at an attachment to an existing view.

• Uses offset.

Wednesday, May 8, 2013

Relationships

Wednesday, May 8, 2013

Get data from other tables

Wednesday, May 8, 2013

Example: related content

Job listing contains an Entity reference to “Company” Wednesday, May 8, 2013

Demo

• Add a new view listing users

• Change to field display

• Check the field options available. Add user image.

• Add a relationship to content written.

Wednesday, May 8, 2013

Contextual filters

Wednesday, May 8, 2013

Contextual filters

• Display related content across the site

Wednesday, May 8, 2013

Example

• https://www.acquia.com/about-us/team/heather-james Wednesday, May 8, 2013

Demo

• Add a block view

• Pull in user ID

• Select, sort and format content

• Place the block!

• Look at related recipes example.

Wednesday, May 8, 2013

Add links to menus

Wednesday, May 8, 2013

Adding menus

• You can add a link to your view anywhere in your menus.

• You can create menus within a set of views!

Wednesday, May 8, 2013

Menus available

Wednesday, May 8, 2013

Add as menu tab

Wednesday, May 8, 2013

Access settings

Wednesday, May 8, 2013

Tab appears!

Wednesday, May 8, 2013

Demo

• How to add a menu item

• Add “my recipes” to main menu.

• Add a parent menu item and sub-menu items

• Look at a live version on our training site In D6)

Wednesday, May 8, 2013

Contributed modules that love Views

Wednesday, May 8, 2013

Views related modules312 Drupal 7 modules http://j.mp/Y2cy6R

Wednesday, May 8, 2013

Calendar

http://drupal.org/project/calendarWednesday, May 8, 2013

with jQuery

http://www.webomelette.com/10-drupal-views-modules

Wednesday, May 8, 2013

Example: Slideshow

Wednesday, May 8, 2013

Adds a format & options

Wednesday, May 8, 2013

Views for admins

• Admin Views http://drupal.org/project/admin_views

• Overrides all admin pages with Views!

• Views bulk operations http://drupal.org/project/views_bulk_operations

• Provides a display format and editing options such as changing author or field values

Wednesday, May 8, 2013

Workbench

http://drupal.org/project/workbench

Wednesday, May 8, 2013

Demo: VBO

• If time allows!

• Demo modifying a view to add views bulk operations.

• Add to the Content by user list.

• Add a "Bulk operations" field, available to all entity types.

• Configure the options available

Wednesday, May 8, 2013

Configure VBO

• Add field and selection options available

Wednesday, May 8, 2013

VIEWS NEXT STEPS!Your assignment

Wednesday, May 8, 2013

Your assignment

• Last week you made a view, right?

• This week:

• Add a display with an attachment

• Make a contextual filter or use a relationship

• Add a link to your menu

• Watch tutorials 4 parts, 5 mins each! http://www.drupalgardens.com/content/new-views-tutorials-4-part-intro

Wednesday, May 8, 2013

Views webinar!

• Tips and Tricks for Getting the Most Out of Views [April 30, 2013]

• http://j.mp/mostviews

• Suzanne Kennedy, Evolving Web - one of our training partners.http://training.acquia.com/events/canada

• DrupalCon: Mastering Views Configuration

• http://portland2013.drupal.org/node/3718

Wednesday, May 8, 2013

Next up!

• Viws mini course - May 2nd: Introduction to Views- May 8th: How to build flexible views < -- you are here- May 15th: Build your first module to back up your views!

• Drupal essentials- May 22nd: Drupal Essentials: How to Configure Accounts in Drupal

• Drupal for Project Managers mini-course- May 29th-June 19th: 4 weeks - Drupal for Project Managers!

Adam Boysen, Jakub Suchy, Amye Scavarda, Jenn Sramek

Wednesday, May 8, 2013

Next week:

• Views Quality Assurance• Theming Views• Caching and performance tips• Build a module to back up your view!

Wednesday, May 8, 2013

Events! Learn in person

• http://acquia.com/events

• http://training.acquia.com/events

• http://dublin2013.drupaldays.org/

• http://www.drupical.com/

Wednesday, May 8, 2013