This page is archived
We're keeping this page up as a courtesy to folks who may need to refer to old instructions. We don't plan to update this page.
Alternate resources
This series outlines the two most powerful features in Drupal: Fields and Views. These two building blocks are fundamental to building Drupal sites. The Field module comes with core and allows you to customize entry forms for entities, like node or user forms, by adding a variety of fields—such as checkboxes, select lists, or file uploads. The Views module is a contributed module that is the natural counterpart to Field, letting you get data out of your site rather than into it. Views allow you to create pages and blocks that pull data back out and display it to your visitors. Anywhere there’s a list of content on your website (and most websites are almost all just lists of content in one form or another), Field and Views are the two key modules you need.
See our guide Using Drupal Book by O'Reilly Media to access all of our tutorials related to this book. Each series covers a chapter (or appendix).
This series will introduce you to the two most powerful features in Drupal: Fields and Views, fundamental building blocks when it comes to building Drupal sites. The Field module allows you to customize entry forms for entities, nodes and users, and comments. The Views module is the perfect counterpart to Field in that instead of putting content into your site through an entry form, Views allows you to get that content back out again in the way that you want.
In this lesson, we're going to be looking at building a job posting board for a university. We'll examine our case study and what it is that we need to do for this job posting board. Drupal core provides this site with a lot of good starting pieces, but we're also going to need to use some additional modules. We're going to focus on the core Field and Field UI and File field in order to create the custom forms that we need for the input for jobs and applications.
If you'd like to follow along with this series, you should install the Using Drupal Source Code and use the Chapter 3 Job Posting Board Installation Profile during the installation process,
Additional resources
The Field module provides an extremely flexible framework for creating forms to enter content. In past versions of Drupal, this was provided by a contributed module called the Content Construction Kit, or CCK, but this now a feature that comes with Drupal core itself. In this lesson we're going to get an overview of the Field module and the pieces it provides, including field types, input widgets, displays, view modes, and formatters. We'll also take a look at reusing existing fields and what that means.
Additional resources
To build this site, we’ll need to go beyond the default “Basic page” and “Article” content types offered by Drupal core. To get started with our job posting website, let’s think about the different content types needed to build all the functionality that we require. The site requires two different types: a Job Posting and a Job Application. In this lesson we'll map out our content type needs, and see what fields were going to use. Then we'll create the Job content type, making sure we add needed fields and set permissions so that it is working as expected.
Additional resources
The References module is a contributed module that allows you to create relationships between nodes and/or users. In this lesson we will take a look at the References project, explaining how References work, and then discuss some similar modules out there you may want to investigate.
Additional resources
Now we need to add a primary contact for the job position we've created. This will usually be the person creating the entry, but we’ll allow the user to enter any of the possible faculty members on the site. This will be done as a “User reference” field, provided by the contributed References module.
Additional resources
For usability, it’s often important to display forms and page contents in a specific order, and to add formatting so that it’s more clear what data is being presented. In this lesson we'll modify our Job content by reordering the fields, changing the field label display, and looking at how we can hide particular fields.
Additional resources
Now that the university is able to create job postings, it would be helpful if prospective employees could submit resumés to the positions in which they’re interested. In this lesson we will build out the Job Application content type. We will need to add another reference field, this time a node reference, to tie the applications to the correct job. To make it possible for applicants to submit their resumé we'll also need to add an upload field so that applicants can upload a document of specified file types.
Additional resources
The Views module provides listings of data on your site: users, comments, nodes, and more. Any listing of data provided by the Views module is called a view, and most Drupal websites today use Views in many different ways. In this lesson we'll get an overview of the Views module, including some specific concepts and terminology like Data Types and Displays, along with a tour of the major view settings and what they do.
Additional resources
The requirements of our site include two different main views. One view is a public-facing list, showing all the available jobs to users of the site. In this lesson we'll create our first view by enabling the modules we need, walking through the Views wizard to get our basic view in place, and then modifying various settings for our fields and working with contextual filters.
Additional resources
The Applications view will serve both as a tool for administrators and as a reference for users, with three different displays. In this lesson, we'll start to build the Applications view by creating the default display with our first listing, which is a master list of all the applications on the site. To pull in all of the information we're going to need, we'll begin working with Views relationships.
Additional resources
With our basic Applications view built, we have our default display. We also need another faculty display on the site. This second list will be largely the same as the default list, but it needs to show up as a tab on a job posting node, and only list the applications which relate to that particular job. We're going to need to create a new display, and override certain settings, plus add in a contextual filter, in order to get this view completed.
Additional resources
In this lesson we tackle the last display we need for our Applications view, by building a block for our applicants. This has us creating a new type of display, a block, as well as continuing to work with overrides. We also have to change the permissions on this particular display so regular users can see it, but at the same time we only want the view to show a user their own applications.
Additional resources
The basic job website that we’ve built only touches on the surface of the capability of Field and Views. There are a lot of possibilities for extending the functionality of this job site by adding more fields to both the Job and Job Application content types. In this lesson we'll review some other modules to explore:
- Automatic Node Titles
- Node Reference URL Widget
- Content Access
- Field Permissions
Additional resources
This series taught you how to use two of Drupal’s fundamental “building block” modules: Field and Views. These modules constitute the cornerstone of Drupal’s power and are used extensively throughout the rest of the Using Drupal series. In this summary we'll take a tour the Epic University site we've built to discuss how we built it. We'll wrap things up with a review of the modules and resources we've covered in this series.