Adding a Block Display to a View
0 (0 Likes / 0 Dislikes)
Adding a Block Display to a View
with Blake Hall
This tutorial covers how to add
a block display to a View.
By the end of this tutorial, you'll
know how to add a block display
to the Recipes view to display
the most recent recipes in a sidebar
and change its configuration
without changing
the existing Recipes page view.
Before you get started
with this tutorial,
you'll want to make sure
you know what Views are
and the basics
of how they're constructed.
You'll also want
to make sure you've created
the listing page Recipe view.
In addition,
your site will have to have
recipe content items with the
main image field.
It's also a good idea that a few
of these items are already created,
so we have content that will show up
in the View display
we're about to build.
From our site, we're going to
navigate to the
Views administration interface by
clicking Structure and then Views.
From here, we're going
to find the Recipes view
and edit it by clicking on
the Edit button.
Alternatively, we could have
navigated to the Recipes page
from the main site navigation
and then clicked Edit view
in the contextual link
in the main area of the page.
Now that we're
on the Administration page
for the Recipes view, we're going
to create a new block display
by clicking Add under Displays.
From this dropdown, we're going to
add a new block display.
The new display is created
and the focus is automatically
switched to its configuration.
To change the title of this display,
we'll click a block
from under the Display name field.
The name and description
of this display popup appears.
We can change the Administrative
name to Recent recipes
and click Apply.
To change the title of the block,
click Recipes in the title field
under Title.
In the popup that appears
we'll select This block
under the For select list,
that changes it to This block override.
We'll change the title to New recipes
and click Apply for this display only.
To change the block style,
click Grid in the format field
under Format.
In the popup that appears,
we're going to select
This block override
from the For select list,
then we'll select Unformatted list
and click Apply for this display.
You can further configure
the style options
in the next popup that appears.
We're going to accept the defaults
and then click Apply.
To configure the image field,
we'll click Content
main image under Fields.
In the popup that appears
we'll again select
This block override
in the For select list,
then we'll select the Image style
Thumbnail instead of Medium,
and then we'll click Apply
for this display.
To remove ingredients as a filter,
click Content, Ingredients
exposed under Filter criteria.
In the popup that appears
select This block override
in the For select list,
and then we'll click
Remove at the bottom,
To configure how we want
Content sorted in the View,
click Add from the dropdown button
under Sort criteria.
In the popup that appears,
in the For select list,
we'll again, say, This block override,
we'll check Authored on as our criteria,
and then click Apply for this display.
In this configuration popup,
we're going to select Sort descending
to have the most recent recipes
appear first,
and then will click Apply
for this display.
To specify the number of items
that will be displayed,
click Mini in the Use pager field.
In the popup that appears we'll again
select This block override.
Under Pager we're going to select
Display a specified number of items,
and then we'll click Apply
for this display.
We're going to choose to select 5
for the number of items to display,
and then click Apply.
With these changes in place
to our Recent recipes view
we're ready to click Save.
With our block display added
to the View,
we can now place this
in the sidebar region.
See the video on Placing Blocks
if you need help.
But in order to see it in action,
let's navigate back to the homepage.
It's worth noting I've already placed
the block in the video
but here you can see it showing up
in our second sidebar region.
In this tutorial
we added a new block display
to our Recipes view.
We then modified
the display settings for this block
so the information it would show
is different than that
from the page view.
It's important to note
that these settings
are independent
of the listing page settings
that's why we we're clicking
This display override.
We then placed
our new block display in the sidebar
to see it in action on our site.