Check your version

This video covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Adjusting the Settings for Each Panel Pane

Video loading...

  • 0:04
    Hello, and welcome back to Drupal and Panels.
  • 0:07
    We just talked about how to create a custom two-column layout for our homepage,
  • 0:11
    and what we're going to talk about now is how to make the content on this page different
  • 0:15
    based on who's looking at it.
  • 0:17
    So, right now we have an advertisement on the left-hand side,
  • 0:19
    we have an article on the right;
  • 0:21
    If we wanted that advertisement only to appear who are not logged in to our website,
  • 0:25
    we can do that. We can use Panels to make different content appear
  • 0:29
    on the left-hand column when people are logged in.
  • 0:32
    There's actually two different ways to solve this problem,
  • 0:34
    and the first way we're going to talk about solving this problem
  • 0:37
    is by using the 'Visibility' settings for each content pane itself.
  • 0:43
    So we're going to start by editing our panel.
  • 0:45
    We'll click the 'Contextual Administration' link at the top right-hand side of this panel; it says 'Edit Panel'.
  • 0:51
    That'll take us to the 'Content' section of the Page Manager interface.
  • 0:55
    This is where we see our wireframe layout of what our page should look like.
  • 1:01
    You'll notice that each content pane itself has a little cogwheel at the top right-hand side,
  • 1:06
    and that's how we get to the settings for each content pane.
  • 1:09
    So we're going to start with our advertisement,
  • 1:11
    and what we want to do here is take a look at the settings that are provided by Panels.
  • 1:18
    We've already visited two, we've already checked out this settings option here.
  • 1:21
    We did this through the Panels In-Place Editor.
  • 1:23
    We notice that settings takes you back to the form that you were given
  • 1:27
    when you were adding this piece of content to the page in the first place.
  • 1:31
    So, we were offered to allow an over-write of the title,
  • 1:35
    so what we're going to do here is change that again, and also
  • 1:38
    in this settings dropdown we have an access to the styles.
  • 1:41
    This is also something we changed through the Panels In-Place Editor interface.
  • 1:46
    We could change it again here, if we wanted to change the system style.
  • 1:51
    The third thing we're going to talk about are the 'Visibility' settings for this particular content pane.
  • 1:57
    And the 'Visibility rules' are very similar for panels, as they were for blocks.
  • 2:01
    So, for those of you who are familiar with blocks, we can go to the blocks interface,
  • 2:05
    and check on the configuration of, for example, the search form.
  • 2:10
    And here you can see that we have the ability to over-write the title,
  • 2:13
    just like we do with Panels, and we also have 'Visibility settings' here at the bottom.
  • 2:18
    This is how you decide which pages your blocks should appear on.
  • 2:21
    The options that are available to us here are just 'Pages', which is where we enter in a path,
  • 2:27
    basically a URL stream. And we also have 'Content types',
  • 2:31
    where you can determine a specific type of content that it's supposed to appear next to.
  • 2:35
    And user roles, so we could say: if the user is logged out, show this block;
  • 2:40
    if the user is logged in, show this block, etcetera, etcetera.
  • 2:44
    We're going to do the same sort of thing with our content pane.
  • 2:47
    So, back to our Panels interface.
  • 2:52
    Only here, you'll notice that there are a lot more options for Panels under the 'Visibility rules' section.
  • 2:57
    So if we wanted to add a new rule, you can see that there are options here for context
  • 3:00
    which we'll talk about a little bit later.
  • 3:03
    The 'Current theme', the 'Front page', 'PHP Code' (which I would not recommend using
  • 3:07
    but sometimes it's your last resort),
  • 3:10
    and the 'URL path', just like we saw with the block module.
  • 3:14
    The 'User Bundle' which is sort of like a user type;
  • 3:17
    we haven't gotten to that yet but we'll talk about it a little later.
  • 3:21
    'User role', which we saw in Panels, and also 'User permission',
  • 3:24
    which is a slightly more specific way of accessing User.
  • 3:29
    So, what we're going to do here is use 'User role' because we want to
  • 3:33
    make this advertisement invisible to people who are logged in.
  • 3:37
    So we'll click 'Next'.
  • 3:39
    The top option here can sometimes be confusing because what Drupal's trying to ask you is:
  • 3:44
    which user should we check the role on?
  • 3:46
    And in this case, we want to check the role of the user who's looking at the page,
  • 3:50
    and that's not always the user who's logged in.
  • 3:53
    In fact, what we want to do is check and see if that user is logged out.
  • 3:59
    So if the user is logged out, which is an 'anonymous user' is Drupal-speak
  • 4:03
    then we want this block to be visible.
  • 4:06
    If the user is logged in then we don't want it to be visible.
  • 4:08
    So when you're reading this page you need to think of the dropdown option
  • 4:11
    under the very first question here for 'User', as if it were saying user who's looking at the page.
  • 4:18
    And then you can read this form as, if the user who is looking at the page is logged out
  • 4:24
    then you want to show the advertisement block.
  • 4:27
    Then the advertisement block will be visible.
  • 4:31
    So we're going to go ahead and click 'Save'.
  • 4:32
    And just to make sure we've got that correct, we're going to 'Update and save' our panel.
  • 4:37
    Then we should notice that the advertisement block disappears for us since we're currently logged in.
  • 4:41
    And it has, which is great.
  • 4:44
    So now what we're going to do is go back and add two more pieces of content in to the left-hand sidebar.
  • 4:48
    The first one will be a search form, and we'll choose an Advanced search,
  • 4:51
    and the second one will be a list of users who are online.
  • 4:55
    So, in order to add the search form we're going to use the 'Contextual' cogwheel at the top-left.
  • 5:00
    We're going to click 'Add' and the search form is located in the 'Widgets' category on the left.
  • 5:04
    So we'll add the 'Advanced search' form here,
  • 5:07
    we'll leave everything as they are, which is fine.
  • 5:10
    Click 'Finish'. And then we're going to also add a list of currently online users,
  • 5:17
    which is found under the 'Activity' category; it's called 'Who's online'.
  • 5:21
    Drop that in, also. And we'll slide the search form to the top page.
  • 5:26
    So we'll click 'Update and save' and now you'll notice that we'll see both 'Advanced search' form and also a 'Who's online' block.
  • 5:36
    So, now that we've got the content showing up, the rest of that's great.
  • 5:39
    But we need to make sure that this content doesn't also appear
  • 5:42
    for people who are logged out.
  • 5:44
    So we're going to go back and edit this panel again;
  • 5:46
    we're going to use the 'Contextual Administration' link; click 'Edit Panel',
  • 5:49
    and we're going to adjust the settings on these two new content panes we've added.
  • 5:57
    So we're going to start with 'Who's online',
  • 5:59
    and we're going to add here a 'Visibility rule' to make sure that this block only appears
  • 6:03
    for a specific 'User role'.
  • 6:05
    And we're going to check that the user looking at the page is logged in,
  • 6:08
    which is authenticated. We're going to click 'Save',
  • 6:12
    and now that pane should only appear when the user is logged in.
  • 6:16
    We're going to do something a little extra-sneaky with the 'Content search form',
  • 6:20
    where the first thing we're going to do is add that same 'Visibility' check
  • 6:23
    just to make sure that the 'User role' is a user who is looking at the page
  • 6:30
    must be logged in, which is good, but now we're also going to make sure that
  • 6:34
    the user who is logged in has permission to do an Advanced search.
  • 6:39
    So we're going to add a second 'Visibility' rule here, for a specific permission
  • 6:44
    and make sure that they have permission too, and here's a list of all the permissions Drupal provides.
  • 6:51
    We're going to go down to the 'Search' module and say 'Use advanced search'.
  • 6:55
    So, that way we don't get a search block showing up for people who don't have permission to run that search.
  • 7:00
    Then we'll click 'Save'. There's also something else that you should know
  • 7:03
    about the 'Visibility rules', and that's that you can control how they combine.
  • 7:07
    So, in our 'Content search form' under the 'Visibility rules' setting
  • 7:11
    you can see now we have one for the user looking at the page is logged in
  • 7:17
    or the user looking at the page has the ability to run an advanced search.
  • 7:22
    There's also an option here for 'Settings' at the bottom.
  • 7:25
    If you click 'Settings', you can decide whether all of those criteria you specified
  • 7:29
    must be true, or if only one of them must be true.
  • 7:34
    So what this is basically asking is, if you want those
  • 7:36
    two criterias 'and'-ed together or if you want them 'or'-ed.
  • 7:40
    And with Panels you can either choose all of them must 'and' or
  • 7:44
    all of them must 'or'. You can't mix and match.
  • 7:46
    We can talk about other ways to solve those problems.
  • 7:48
    This, most of the time, will get you through them.
  • 7:51
    In this case, we want both of those criteria to be true;
  • 7:54
    we want them to be 'and'-ed together so we'll leave it as 'All',
  • 7:56
    but if you needed it to be one or the other you do have the option here, to save that.
  • 8:01
    So now we're going to go ahead and 'Update and save' this panel again,
  • 8:04
    and when we look at our front page, we can see both options here.
  • 8:06
    And if we were to log out we should see just the advertisement.
  • 8:11
    And there it is.
  • 8:12
    So that's how to make the same page, which is a panel, display different content based on who's looking at it.
  • 8:18
    Thanks a lot.

Adjusting the Settings for Each Panel Pane


Each piece of content placed into a panel has it’s own configuration settings, covering everything from display style to access control. In this lesson we will take a tour through the settings for each pane.

Additional resources:
There are no resources for this video. If you believe there should be, please contact us.