Drup

Page 165

we’ll be overriding a particular portion of a view, other than settings. In this case, overriding works a little bit differently. Click on the Arguments section title, which will allow you to override all the arguments of the view at once. It’s not possible to override only an individual argument (or an individual relationship, field, sort criterion, or filters). When overriding a portion of a view, the font will become unitalicized, indicating an override, as in Figure 3-45. After choosing to override the arguments of the Job Tab display, we’ll add an argument that filters the list of applications to a single job node. Click the + (plus) icon in the Arguments area and use the values from Table 3-36. The Node ID argument allows us to filter by one particular job’s ID. Here we’re using another feature of Views arguments: a validator. Views will check the node ID passed in to the URL and verify that it belongs to a job node. Click Update when finished. Table 3-36. The Job Tab display arguments of the applications view Job Tab: Argument settings

Values

Node: Nid

Relationship: field_job_nid Title: Job Applications for %1 Action to take if argument is not present: Display empty text Validator: Node Types: Job Validate user has access to the node: Checked

5. Now that we’ve set up an argument for this display, we need to give it a URL. Use the settings from Table 3-37 to set up the Page settings and click Update. Table 3-37. Job Tab display page settings Job Tab: Page settings

Values

Path

node/%/applications

Menu

Type: Menu tab Title: Applications

Similar to using %1 in the title, we’re using the percent symbol to specify that the first argument will be in the middle of the URL. You can use this approach to add tabs to user pages also, such as user/%/my_display, or any other page in Drupal with a dynamic path. 6. And finally, we no longer need the Job listed on this display; it will be redundant, as we’ll be looking at the job directly. Click the Fields section title, and click Override. Then, click Content: Node reference: Job and click Remove.

Hands-On: The Views Module | 141


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.