In this exercise we’ll configure the job listing so it filters by terms of employment.
If you’ve already created the Job list view, skip to the step
If you don’t have the job listing view, we’ll create it and set the filter criteria.
Go to Structure → Views → Add new view. Configure with these settings:
View name: Job listing
Show “Content” of type “job posting” sorted by “Newest first”
Select the Create a page checkbox
Keep the defaults for the page setting
Select Create a menu link
Menu: Select Main navigation Link text: Jobs
Click Save and edit
Based to knowledge acquired from previous units in this manual, add a filter by terms of employment, and expose to the site visitors. Use the preview section located below the view configuration form to accomplish this task. Once you are happy with how it has been configured, save the view.
Hint: Use the screenshot below if you need some guidance.
Review your changes by checking your homepage. “Jobs” will be part of the main navigation (because you added it to the menu) and you’ll now see a dropdown menu that filters the job postings.
Content types often share information such as taxonomy terms, authors, and so on. We may also want to add in a relationship between content types so that we can share data (fields) from one content type with another. When you first set up a view, you select your “base table”. By adding in View relationships, you can share information from tables of other content types.
To experiment with these features, try the following exercises:
Add a post date to the listing so the jobs can be sorted by date
Customise the Agency link field to display inline with the label (this may require adding some inline CSS, or using the span setting).
Rearrange the fields like we’ve done in the screenshot below
In this exercise we learned that you can expand the fields available to a view by using relationships. We also saw more about the various display formats available with views.
You also learned how to change the markup output by Views.
Most people looking at jobs websites like a quick way to sort the job postings. For example, jobs could be sorted by the type of employment - full-time, part-time, etc.
In this exercise, we’ll add in the logo of the agency offering the job, by setting up a View relationship. In the current setup, the agency’s logo is part of the Agency content type, and the view of Job Posting doesn’t allow us to show it. If we link the two content types together, we can display the agency logo in the job posting (like the screenshot below).
Add some new Agency content and upload a logo for each. See the screenshot below for an example.
Update some existing Job postings to link to the agencies setup in step 1. See the screenshot below for an example.
Next, we need to add a relationship to the main Job Listing View so that we can join the data from the Agency content type (specifically the logo) into the Job posting content type.
Without the relationship set up, if you tried to add a new field of “agency logo” to the Job posting content type the results would be blank.
Go to the edit screen of your Job Listing view Click on Advanced in the right column. Under "Relationships" click Add.
Next, search for "agency".
Select Content referenced from field_agency
Click Add and configure relationships. This will take you to the next configuration screen. Do NOT check the box "Require this relationship".
Click the Apply button.
In the Fields section of your Job Listing view, click on Add field. Then search for logo (this is the logo field in your Agency content type).
In the fields setting, apply the following settings as show in the screenshot. - Set the relationship to the one you created in previously. - Give it a Label - Set an appropriate Image style - Optionally set "Link image to" content.
Important! Remember to set the Relationship to reference the relationship created in the preceding steps.
Change the Format to "Table" so the final output will look similar to the screenshot at the top of this page.
Save your View and visit your job listings page to view the results.