This video continues the process of adding a custom field handler started in the previous chapter.
Additional resources
In this video Joe continues the discussion of using hook_views_data()
to describe a module's table to the views module. Building on what was covered in the previous chapter we now deal with exposing one of the individual columns from our table as a field that views can use for filters, sorts, and to display.
Additional resources
Modules Needed
In this chapter Joe will take a look at where to get a copy of the databasics code and what it does already. Throughout the rest of this series we will be working towards replacing functionality from the databasics modules with views integration in order to allow for greater flexibility in the ways that our module can be used. We'll talk about each of this pieces of functionality in this chapter.
Additional resources
Databasics module on GitHub
Overview of the Database Layer in Drupal 7
To get things started, in this lesson we'll create a new module, and use hook_views_api() to let Views know we want to use its API.
In this lesson, we give a brief overview of utilizing a very important feature when it comes to working with Drupal and that's Drupal.org. We show you how to get to the Views API documentation that is now part of Drupal's API documentation and teach you how to use the search function for finding particular function.
Additional resources
The Learn Drupal Ladder
CourseIn this series we introduce the Drupal Ladder project, and walk through the lessons in the Drupal Ladder.
In this video we'll be looking at some background on this project, and then we'll be looking at how you can actually get involved and progress to becoming a contributor yourself.
The Drupal Ladder Project was a community initiative that started in 2011. The purpose of the project was to get more people contributing to Drupal Core, by teaching people the skills that they need, exposing them to the tools that they need to use within the Drupal Community, and teaching people not just Drupal best practices in terms of code, but also how to actually interact and work with the community.
Additional resources
Coding for Rules
CourseThis chapter shows how to create a basic Rules action. It covers:
- The role of the module.rules.inc file
- Using hook_rules_action_info
- Writing action callbacks
This series covers the basics and some more of how to write your own plugins to extend the Rules module. It includes:
- A conceptual overview of the Rules modules
- Writing action plugins
- Managing rules data as parameters for Rules plugins
- Writing conditions
- Writing and invoking Rules events
This intro chapter contains a quick presentation of the Rules module from a conceptual perspective. It includes:
- Actions, conditions, events
- Data types: the importance of entities, relationships and tokens
- Lists and loops
- Components and parameters
- Some words about the Rules user interface
If you would like to see more about configuring Rules before continuing this series on writing code to integrate with the Rules module, you can watch the Learning the Rules Framework series. Note that Johan is using the Module filter module to provide the tabs and filter box on his module administration page.
Area handlers are used in the header, footer and empty text areas when creating a View. In this lesson, we’ll walk through creating our own area handler that can be placed in the footer to provide a summary of all the rows in our View.
In this lesson, we’ll take a look at how to modify the HTML output from Views, explore some of the default templates that Views provides, and learn about the various permutations of names we can give our template files to override output for everything from a large set of Views to a single field on a single View. We’ll also discuss the difference between displays, styles, rows, and fields when it comes to theming a View.
Install Git
FreeIn this video we walk through getting Git version control installed, and then show how to do a few basic things, including how to get a copy of the latest Drupal development code. This video follows the instructions found in the Install Git lesson on learndrupal.org.
This video is installing Git on Windows, because it has the most steps involved. Installation on Mac and Linux is very simple, in that they do not have a wizard to walk through, so they are not demonstrated. All commands used on the command line in the video work on Windows, Mac, and Linux, because Windows is using the Git Bash shell which is part of the Git installation.
Additional resources
In this step we turn our attention to Drupal.org and the community issue queue. This is where all of the active work for Drupal core takes place. We will look at the queue and create our issue to see how it works. This video follows the instructions for the Getting started in the issue queue lesson on learndrupal.org.
Test Patches
FreeIn this video we will walk through the process of testing existing patches in the Drupal.org issue queue. We will read an issue, download and apply the patch with Git, and then test it to see if it works. This video follows the instructions on the Test patches lesson on learndrupal.org.
The lines that I have in my .bash_profile (shown at the end of this video) to add the Git branch to my command line prompt is:
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="\h:\W \u\$(parse_git_branch)\$ "
I'm using a Mac, so your mileage may vary on other systems.
Write a Patch
FreeIn this video we will write our own patch to resolve an issue. We will take a screenshot of the issue before and after our patch, and upload the images and patch to the Drupal.org issue queue. This video follows the instructions in the Write a patch lesson on drupalladder.org.
There's a reason views is the most popular module on drupal.org and it's pointy-clickly user interface is only a part of that. In this series we cover the ins and outs of writing modules that implement the Views API. Once you’ve realized the power of creating complex lists of nodes, users and other content via the views UI the next logical desire is to allow people to do that with the content provided by your custom module as well. This series will take an in-depth look at exposing your own database tables to the Views module so that users can use them as a place to pull content from including the fields themselves and meta-data about how they can be used to create relationships to other content on your site.
After getting the basics out of the way we’ll also take a look at writing our own custom field handlers to expose our module’s data to views so that it can be sorted, filtered, and queried in new ways. We’ll also look at implementing views plugins to do things like add custom access control options to views and to add new output styles.
Once you understand a bit more about how views works under the hood and how easy it is to tie in to that system you’ll be reimaging your solutions for all sorts of different problems.
In this video Joe describes the process of adding the rest of the fields from the databasics module to our implementation of hook_views_data() including how to differentiate between different data types like strings of text and numeric values and how this changes the views module's behavior. Then Joe talks about how to tell views about various tables that can be used in relationship to the databasics table via foreign keys like the node ID.