Mar 13 2013
Mar 13

Episode Number: 

127

Update: If you want the labels to show up, install the jquery_update Drupal module and inside the configuration options select jQuery version 1.8. This will fix the label issue.

The Drupal 7 FooTable Module makes it easy to build responsive tables using the Drupal 7 Views module. The FooTable module makes a table responsive by allowing the user to select which fields should be hidden at various responsive breakpoints for mobile and tablet devices. Any hidden fields are then displayed below the table in an expandable section. The module still needs a little work, but is a great way to get started with responsive design and responsive layouts in Drupal.

In this episode you will learn:

  • How to install and configure the FooTable Drupal module
  • How to create a responsive Drupal views table using the FooTable Drupal module
  • How to test the various responsive breakpoints using the Web Developer toolbar chrome extension

Thanks to BuildAModule.com for sponsoring this episode of the Daily Dose of Drupal.

DDoD Video: 

Mar 04 2013
Mar 04

Episode Number: 

120

The Views Data Export Module provides an easy way to export your views data in many different formats (CSV, XLS, DOC, TXT, XML, etc).

In this episode you will learn:

  • How to export Drupal 7 views data as a CSV file
  • How to export Drupal 7 views data as an XLS file
  • How the Drupal views page display is handled independently of what is actually exported in the Views data export

Thanks to Drupalize.me for sponsoring this episode of the Daily Dose of Drupal.

DDoD Video: 

Feb 23 2013
Feb 23

Episode Number: 

114

The Drupal 7 Views Calc module provides an easy way to do calculations on the numeric data that is displayed within a Drupal 7 View.

In this episode you will learn:

  • How to create a Drupal 7 Views Calc view
  • How to use Views Calc to perform calculations such as SUM and AVG on a Drupal 7 field within a View

Thanks to Drupalize.me for sponsoring this episode of the Daily Dose of Drupal.

DDoD Video: 

Feb 13 2013
Feb 13

Episode Number: 

107

The Drupal 7 Views Accordion module allows you to build a Drupal View with results displayed in jQuery accordion tabs.

In this episode you will learn:

  • How to install and configure the Drupal Views Accordion module
  • How to build a simple Drupal View using the Drupal Views Accordion module
  • How to change the Drupal Views settings to alter how the Views Accordion module works

Another big thanks to Drupalize.me for sponsoring this episode of the Daily Dose of Drupal.

DDoD Video: 

Feb 04 2013
Feb 04

Episode Number: 

101

The Drupal 7 Menu Badges module is a neat little module that allows you to add numbered badges next to menu items on a Drupal 7 website. It integrates nicely with views so you can easily add your own numbered icons to any menu link. You will also need the Link Badges module for this to work.

In this episode you will learn:

  • How to add a Menu Badge to a Drupal PrivateMsg link
  • How to create your own custom Menu Badge using Views and apply it to a Drupal menu link

Today's episode was sponsored by Drupalize.me

DDoD Video: 

Dec 14 2012
Dec 14

Episode Number: 

67

Note: In this video I do not mention that you need the jQuery Cycle plugin installed to get this working. I already had it installed in my video. You can see information on how to do that in steps 3 through 7 on http://drupal.org/node/903244

The Drupal 7 Views Slideshow module makes it easy to add a slideshow to display rotating content on any Drupal 7 website.

In this episode you will learn:

  • How to create a simple Drupal content type with an image field to use for the Views Slideshow
  • How to create a block that displays as a Drupal 7 views slideshow
  • How to rewrite the Drupal views output so you can more easily style the slideshow with CSS

DDoD Video: 

Nov 20 2012
Nov 20

Hello everybody and welcome to another Episode of the Daily Dose of Drupal, we’re on Episode Number 52 today. I’m Shane, you can follow me on Twitter @smthomas3, you can also got o codekarate.com and sign up for the newsletter and check out everything else on the website.

Today we’re going to be going over the Views Bulk Operations Module. I’m just going to over to the very basics of it because you can do a lot with module and it integrates in with Rules and a couple of other things that you can see here that play nicely with the Views Bulk Operations module but we’ll go ahead and get started and I’ll show you simple example and then you can take it from there.
First thing I’m going to do is hop over to my command line and I’m going to use Drush to download the module. You can see it has two modules; Actions Permissions and Views Bulk Operations. Actions Permissions I believe it creates a permission for each of the various Views Bulk Operations so you can separate it out who can use which operation.

So I have my test site here, I’m going to hop over to the module’s page and I already have Views installed so you’ll need to make sure you have views installed if you do not already. You’ll also notice the Views Bulk Operations module requires the Entity module.

So I’ll go ahead and search for Drupal Entity and you can see that the Entity API module is here so you’ll need to download that as well, so go ahead and do that and I’m just going to go Drush Enable Views Bulk Operations and Entity, go ahead and click Yes and if I refresh the page on my modules page you’ll see that Views Bulk Operations module has been turned on, it looks like I’m using 7.x-3.0 and we’re going to go ahead and create a very simple view to show you what you can do here.

So I’m going to add a new view; I’m just going to call it VBO Test and we’re going to show content of type, we’ll go ahead and show all and we’ll go ahead and leave the rest of that the same. Over here we’re going to go ahead and just click on Continue and Edit, we’ll just leave it at most of the defaults. Now the trick here is going to be changing the format I believe, we’re going to change this to a table and we are going to go ahead and keep the defaults here, go ahead and apply.

So now we have a very basic View, the next step is of course to get the Views Bulk Operations filters, I guess you can call them Setup. I guess it’s not really filter, it’s more of like a dropdown to perform Bulk Actions on the view and just a quick step back so you can understand what this does.

What this module actually does is it allows you to … let’s say you have a list of content and you want to maybe perform one action on that entire lists at once. This is going to create checkboxes along the left side of the View, allow you to select Multiple and then perform one action on multiple selections at the same time.

The other thing that you might want to take a look at. I’m just going to go over the basics today so may want to look at the documentations so there’s a Read Documentation page on drupal.org and this is going to walk you through some actions and snippets if you need to add that, looks like there’s not much there but VBO for Drupal 7 is going to come over and give some Rules Integration, some Aggregation things and just some basic information.

So you may want to also look at that for a little bit on how to get started but we’re going to go ahead and create this or finish creating this view here. So right now it just shows the title, we need to go ahead and add a new field, we’re going to click on Bulk Operations content and that’s going to add the checkbox to select the row for the Bulk Operations. I can of course add other fields, let’s say we want to show the comment counts, comment status and let’s see if we want anything else here, the post, the date and we’ll go ahead and show content sticky as well just so we can look at that, go ahead and hit Apply.

You can see the Bulk Operations; it allows you to select which Bulk Operations you want to be available. So let’s go ahead and select a couple of them so you can override the label, you can skip the confirmation step, we’re just going to add a couple and we’ll come back and look at this. So we’re also going to make Content Sticky and make Content Unsticky and we’ll go ahead and say we want to skip the confirmation step on those.

The other thing is you’ll notice they say In queue the operations instead of executing it directly and I believe what that does is it just queues up that process so it doesn’t immediately take action and if have a … if you’re doing actions on a lot of nodes at one time, that may be useful to make sure that you’re not trying to do too much and then I believe it will get run on the next Cron run and then maybe broken up depending on how many different pieces of content you’re making a change too.

We can also unpublished contents and published contents and we’ll go ahead and hit Apply to All Displays and we’ll the rest of these at their default just so we can get a look at how it’s going to work, I’m going to click Save and I’m going to click on View Page here and you’ll see … obviously it’s not an order and probably moved this checkbox way over here to the left but you can see that it shows that none of these are sticky.

So I’m going to go ahead and select two of them, you can see now I have this Operations Field set up here, choose Operation and I’ll make the contents sticky, I’ll execute it and you’ll notice that now I have two of them that are sticky, I’m also going to go ahead and … let’s say we wanted to unpublished everything, I’m going to click and say Unpublished Content, execute, you’ll notice this one asks me to confirm it so I’ll go ahead and I’ll hit Confirm and now you’ll notice that nothings shows up here because if you go into the View it’s only showing contents that’s published, so you know that that work, we’re going to remove this so we’ll show All Content, save it, come back to the page and you’ll notice that now they’re all showing again, I’m going to go ahead and republished those.

So as you can see this can really be used for administration pages for changing lots of different pieces of contents at once. So if you want to turn comments off for a lot of different pieces of content, you want to publish a bunch of content that wants unpublished and make them sticky, you know all those different operations that you saw, it’s very easy to do with Views, it’s point and click and pretty much makes it easy for you to control the actions or control the workflow on your site and control the content in a much more refined way.

So we’ll take a look at in one more time, you can see there’s a whole bunch of different Bulk Operations, now of course it can’t do everything but it is extensible and that’s where reading it up on how it can work with Rules module and how you can create your own actions, your own Bulk Operations can be used to extend the system and basically create various extensible Views, I can do any type of administration actions that you want.

So that’s it for this time, it’s really pretty simple but this module is extremely powerful and I recommend everyone to take a look at it if they haven’t already and we’ll be back again tomorrow with another exciting topic, Drupal related of course and I’ll see you again next time. Thanks for watching.

Nov 08 2012
Nov 08

Welcome to another Daily Dose of Drupal, we’re on Episode Number 46 today. As always; I am Shane and you can follow me on Twitter @smthomas3 or you can hop over to Code Karate website and check out all the other things that we have going on. A while back on the Daily Dose of Drupal episode I believe it was on the 19th of September I did an episode on the Profile 2 Module and this is going to extend that a little bit and just show you how you can build a view … basically a membership directory using information from those fields that you created with the Profile 2 Module.

Just a quick overview if you don’t remember if you don’t watch that video in the Profile 2 Module will basically allow you to create a separate profile which can be a collection of fields, maybe it’s date of birth, biography, your social media profiles, things like that and have an actual separate profile that’s attached to your user account on a Drupal website.

So this is going to be useful for any type of membership website or any type of social networking website that’s using Drupal where you need to list the actual members of the site. So the first thing that I’m going to do is to make sure that I have Profile 2 and Views installed, which I do and well actually if you look at it let’s come to the modules page and let’s go ahead and confirm that I have the Profile 2 Module installed, Profile 2 is turned on and it looks like I do not have the Views Module.

So we’re going to go ahead and download the Views Module, so I’ll go ahead and use Drush from the command line to just download Views and we will come back into the modules page and use the filter to find and turn on Views and Views QI, so I’ll go ahead and save that and what we’re going to do in this example is we’re just going to create a very basic views page that lists all the members of the site and it also show their profile information if they have any.

So if we go ahead and look at the profile module or the Profile 2 Module we click on Configure, you’ll notice that we have two different profiles; we have a Main Profile and we have a Reviewer Profile. We’re only going to be concerned with the Main Profile here. All this profile has is a Full Name and a Bio Field.

So nothing too difficult, there’s a couple of fields. What we’re going to do now is we’re going to create this View and we’re going to make sure that it links to this Main Profile. Let’s go ahead and look at the users that we have on the site; so it looks like we have a couple of different users so we should have be good to go as far as some basic content for the view.

The View is not going to look at the end but it’s going to be workable and you’re going to be able to use that to build any type of view that you need. If you haven’t used Views before, this probably isn’t the starting point you want to look at, there’s probably a bunch of other tutorials you can go and learn the very basics. This one is going to show you how to build a basic … a fairly basic View but using a relationship. So I’m going to create a View called Site Members, we’re going to show Users and we’ll go ahead and show the newest first, that’s fine, we’ll create a page called Site Members, the path will be test3.codekarate.com/sitemembers and in this case we could show a table format if you wanted a listing and you wanted to be able to easily administer this or a grid format or on format if you just wanted the format with CSS.

I’m going to go ahead and use a grid and we’ll show 12 items and we will have it use a pager and go ahead and hit Continue and Edit. So the first thing we’re going to do is we’re going to add a couple of extra fields here; so we selected the fields and I’m going to go down to user and we already have the user name as you can see, I want to show the user create a date. If this was an administrative page you could show the user e-mail address and user edit link but depending on if you’re showing this to your average user if you want a site membership directory that any user can see, you probably don’t want to show any of those fields, the edit link would only show up of course if they have access to that but you don’t want any user to be able to see user’s e-mail addresses most likely.

So we could add user’s picture if they had one and we’ll go ahead and leave at that. I don’t believed any of the users on this site have a picture so we don’t have anything to show there but if you did have uploaded pictures you would of course see an image there.

So it be come down here, it shows a label of a picture of the user name and the created date, I’m going to go ahead and get rid of the label on the image even though there are no images, just imagine that there would be a user profile picture there if any of these users have actually uploaded the image and for the grid settings we can say maybe we only wanted to be 3 columns, so if we apply that you could see if 3 columns but what we really want is we want to show those extra fields that we have in our profile that we created with Profile 2. So this main profile we really want to show this Bio and this Full Name field.

Now your first thought would be … well let’s just try to add this field but since it’s actually a separate entity you can’t get to it from just a normal fields interface. You actually have to first add a relationship and this relationship is going to reference this original user entity to that profile entity that you created, in this case this Main Profile. So we go and we click on Add Relationships and we’re going to select User Profile and this shows up because of the Profile Module has been turned on, we’ll go ahead and click Apply and you could require this relationship.

What this will do is if any user does not have a profile, they will not show up in this listing, if you check it ... if you leave it uncheck then it will still show the user but these fields will be blank because it won’t actually link to anything, you can select which profile you want to use, in this case I’m only going to show the Main Profile and I’m going to click Apply.

Now that requires if you’re familiar with SQL or Databases it’s kind of like of inter joined versa left joined sequel statement if you’re not familiar with that then that may not quite make sense but basically all the views is just a very fancy user interface for making a specific types of database queries in structuring the results just a way to build simple list and of course it gets pretty complex when you get into the contextual filters and the relationships but what this will allow us to do is it will now allow us to add those fields that we wanted.

So you can see there’s another option here for profile, if you scroll down you can see those or I can just go ahead and limit it so I only see the Profile fields. So now I can select Bio and Full Name, go ahead and hit Apply, I can leave the label, you of course want to use the relationship that you created so you need that to show up there and I will leave … I’ll go ahead and remove the label from this one and then I can of course rearrange them however I want.

So user name, full name, created date and bio, now if I hit Apply and I scroll down I can see that this user of course they must not have profile, they have an old bio, this one has a bio that says Test User but they’re … and this is the user’s actual full name and down here here’s the full name and a bio as well.

So we can go ahead and save this, click on View Page and will take us to Site Members page and you can see I now have a grid of the site members of the website, it has my fields from the profile pulled in and you can do a whole bunch of cool things; you could add different types of filters so you can search for site members, you can do a whole bunch of stuff, so you can come in to the view, you can add a filter; for instance we’ll say full name, go ahead and hit Apply and we’ll go ahead and click Expose here, I’ll just a name, we’ll go ahead and put Member Name and we’re going to use contains … keep in mind this is depending on how many users you have, this could make it relatively slow search query but it will work and we’ll go ahead and hit Apply.

What we did here is we’re adding a filter and we’re exposing it so the user is going to be able to input what they want to search by. So I will show you how that works; so I’ll hit Save and now you can see there’s basically a search box so I can search by member name. If I go ahead and type User you can see that I get just this Test User because it’s searching by this field only, if I search for the first letters of Shane you can see I get this member.

Keep in mind it’s only searching by this field but you can add of course different dropdowns if you had all different types of options for various members and you could use the view to search and filter through these different members. So this is good for building out User Administration interfaces for you if the default user administration interface isn’t good enough for your needs or if you need to build out a membership directory for your other site users.

That’s really all we’re going to go over today, just some Views concepts that we went over here looking at Relationships and Exposed Filters and Views and also using that with the Profile 2 Module so you can help or start building out your membership directory. That’s it for this time on the Daily Dose of Drupal and we will be back again tomorrow with another exciting episode. Thanks for watching.

Nov 07 2012
Nov 07

This is a guest post from Daniel Sipos, a Drupal enthusiast from Brussels. You can follow him on his drupal blog.

There is a really powerful module out there designed to help with searching through your Drupal content. It’s called Finder and gives you a lot of power in filtering down or searching for content. For this article I chose 2 things about this module that I personally found very useful: searching (filtering) via autocomplete widgets and the ability to have blocks that hold this search functionality.

Apart from searching via the Drupal search module, a classic way of allowing your users to search through content is by using exposed filters in Views. This allows users to apply filters to a Page View and narrow down the results of the View according to those. The Finder module is based on Views as well inasmuch as it takes its content from a View (which in my opinion makes it very highly customizable).

Therefore to start using the Finder module, you need to create a View with the necessary content and based on that you can add a new finder. This newly created finder (however configured) will then use the results of this previously created View as content to search through.

You add a new finder like in the image below:

Finder module

Once you created the finder, you can configure it and add elements to it. There are 4 types of elements you can add: select list, text, checkboxes/radio buttons and autocomplete text. Elements are the widgets you actually use when performing a search. The first three can be used also directly in a View with exposed filters - but not the autocomplete widget.

1. Autocomplete widget

Although the Views exposed filters are widely used and for good reason, I found myself wanting the possibility to let my users search through nodes using autocomplete widgets. You know, like when you add a new taxonomy term to a node, you can use the autocomplete widget to type the term in, and if the term already exists, it responsively lets you know.

The form for adding a new element into the finder is depicted in the image below:

Finder module

So after you create your View and Finder, and after you added a new element (in this case an autocomplete), you have to configure the element. The most important thing you need to set is the Field(s) the element will look through when you are typing something in. Note that this is correlated with the Views fields so if you want the element to look through a specific field, make sure it exists in your View.

For the sake of simplicity in this example (and probably common usage too), I will add the Title field as the main field my autocomplete widget will search through (see image below).

Finder module

Once you added the field of your choice, you can already test your finder by going to the path you indicated under the BASIC configuration fieldset. Pretty neat a? If you go back to configure further your finder you’ll find a bunch of options to customize and make it look the way you want it. You can add description, header, footer etc.

More importantly however, you can select the value and field logic (for when you have multiple fields for one element), as well as the matching type (such as contains, equals, starts with etc). What is thus pretty cool is that you can have more elements per one finder and combine them to search and filter through your View (similar to Views exposed filter). Moreover, you can add Ajax so that as you type in the autocomplete, the results filter down automatically as well. I really encourage you to further explore these capabilities.

2. Block finder

In the finder configuration, under BASIC, you can set the path of the page where you will be able to see your View with the finder elements on top for filtering. However, you can also check the box to create a block for the finder. This way, you can place a block in a sidebar (or god knows where else you may be thinking - Display Suite..pfuu the possibilities..) and search through that View from there. To illustrate, I will use my favorite autocomplete widget from the previous example.

Once you added the block to the sidebar, you can go to your front page and start typing in it like in this example - hints will responsively show up in the widget. If you click on one hint, it will take you to the finder page (the one for which you can set the path in the configuration page under BASIC) and directly show you the result. If you add Ajax to the finder, it will also show the results in the block and narrow them down as you type. I don’t know the circumstances in which this last part can be useful for you, but without Ajax, it is pretty cool.

OK, so there you have it, just a touch on the capabilities of this module from my part. I am always open to comments.

Go crazy and like usual, hope this helps. You can follow me on Twitter at @drupalexp

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web