We'll create our very first feature and then see how it works by putting on our production site and enabling it.
Additional resources
Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)
Hands-On: Generating Sample Content (Drupalize.Me)
https://github.com/DrupalizeMe/drupalize-lullablog (GitHub.com)
This video walks through how to use the new hook_page_alter()
in Drupal 7 by transforming an unordered list into an ordered list. Because all of the content, region & blocks are stored within a renderable array before being output to the page, then this new hook allows modules and themes to make changes to page before it is fully rendered.
This video walks through the basic use of Drupal 7's Render API for outputting content, and gives some hands-on experience in navigating and working with renderable arrays. We expand the Menu Magic module by creating several different kinds of page elements to show how renderable arrays work.
This chapter goes through the process of passing a wildcard variable to a function via an argument from the URL. It creates a MENU_LOCAL_TASK tab on the node which inverts the text to display upside down. It uses a page callback function that is included within a separate file in order to save on how much memory is used.
In this video you'll learn how to use api.drupal.org the canonical source for information about Drupal's hooks, APIs, and code documentation in order to find out information about implementing a particular hook, making use of a particular function or library of functions, and even gaining a better understanding of some of the big picture concepts behind Drupal's code and APIs.
Walks through some of the basics elements that are required and common for all Drupal modules. Then we create a simple demo module to see how it works.
This chapter describes how Drupal modules are able respond to specific events through the hook system. A couple of example hooks are implemented in order to see how this process works. This video builds on the demo module we created in the previous chapter.
In this video Joe Shindelar provides a quick overview of the minimum set of tools you'll need in order to get started with module development. Some kind of web server to host your development site on, an editor that allows you to edit PHP files (preferably one with syntax highlighting), a MySQL client, and Drush. Learn about how these essential tools fit in the module developers tool belt and then download and install a bare bones copy of Drupal to start tinkering with.
Provides a overview presentation for how Drupal's menu system takes care of incoming requests via the index.php. Then it walks through the process of implementing a simple module that hooks into Drupal's menu system at the path of /magic.
It then executes a page callback function of menu_magic_basic(),
which outputs some simple markup text.
Additional resources
This screencast gives miscellaneous tips when writing Rules plugins, such as:
- Some words on declaring new data types for Rules
- How to restrict access to plugins
- How to form alter plugin configuration forms
- How to provide additional form validation
- How to use the "base" property to provide a non-default callback function
- How to invoke events programmatically with all arguments in a single array
- How to use drupal_static() to share variables/values with other parts of Drupal
This screencast shows how to add parameters to your actions, for example to allow site builders to select which user object an action should work with.
This screencast shows:
- How to declare that an action provides new data objects to Rules
- How to actually send the created data to Rules
- How to save parameters that are manipulated by the action (but not created by it)
The example used creates an action that returns the number of hits in a selected view.
This screencast shows how to:
- Use text as an input parameter for an action
- Provide your action configuration with a customized select list
- Restrict input for a parameter to "direct input" (and not data selection)
This screencast shows how to create a condition plugin for Rules:
- How to declare new conditions for Rules
- How to provide the condition callbacks with parameters to act on
- The big similarities and the few differences between actions and conditions
In the example, a condition is built to check which view type a provided view has.
This screencast shows how to:
- Invoke a Rules event
- Send parameter data to a Rules event
This is shown by an event triggered every time a view is being rendered, sending the name of the view as a parameter.
This screencast shows how to:
- Declare a Rules event
- Declare the data provided by the event
- Use that data in a rule
The example used creates an event "View is being rendered", passing along information about which view is being used.
This video shows the basic syntax for creating form dependencies with the states system. For a more information about the states system, then be sure to check out JavaScript form dependencies with the States System.
Note: There is a typo in the code used in this video. The function form_fun_states_form()
is missing a parameter, and should be: function form_fun_states_form($form, &$form_state)
.
When writing code for the web it is very important that you pay attention to security. Drupal provides many tools to help you out and in this presentation we'll look at what those are and how to make sure you use them properly.
Additional resources
In this chapter we learn how to get data out of the database and display it. The example walks through writing a module that creates a page that displays how many nodes are published and unpublished for each content type in our site. We use the db_select() function to accomplish this.
In this chapter we learn about changing the definition of a database table after it has already been installed. This example expands on the previous chapters by adding a new field to the table to collect the date a user last visited a node. We learn more about hook_update_N() as well as db_add_field().