Before we jump into building our first Drupal 7 site, we should also take a look at the great resources you have out there to help you on your journey. Being an open source project, Drupal has an amazing community of people who have paved this road before you. In this lesson we're going to look at the free community resources that you can use to not only find answers to your questions, but also connect with thousands of people around the world who are working in the same space you are. -- We are going to take a tour of the communtiy documentation, various Drupal forums, project issue queues, where you can glean a lot of useful information and help, Internet Relay Chat, or IRC, for real-time collaboration, and getting in touch with user groups of like-minded people around the world.
Additional resources
Drupal.org Troubleshooting Guide
Drupal Answers on Stack Exchange
Drupal Groups Site (groups.drupal.org)
Deploying Your Code
FreeIn this lesson we will take the code we have committed to our remote repository and manually push it to our production server. We will cover how to setup deployments on beanstalkapp.com and the some of the advantages of using a tool like this.
A question we are commonly asked is: how did your production environment recognize the new feature?
Answer: Reverting a feature reverts it back to what is in code. So by updating the code it always looks to the code so there is no need to revert it. You usually revert a feature if you have made changes that are stored in the database and you need it to look back to the code as your database changes are not what you wanted or are wrong. If the changes you made in the database are what you want, then you update/recreate the feature.
One thing we haven't looked at in our feature yet is Drupal roles and permissions. Here we will create a role associated with out Blog feature and look at how we can roll that important bit in.
In this video we are using the Environment Indicator module to visually distinguish between different environments.
Additional resources
Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)
https://github.com/DrupalizeMe/drupalize-lullablog (GitHub.com)
Features will auto-detect dependencies for you, which can be very handy, but at times it can also be very frustrating when you don't want them to. In this video we introduce the Features Plumber module and show you how to use it to finely control your dependencies.
We are sometimes asked how Features can be removed. Since a Feature is just a normal module, you can disable it on your module administration page, and even uninstall and completely remove it from your modules folder. That will completely remove the feature from your site.
Note: The Features plumber module is no longer necessary if you're using Features with Drupal 7. The functionality provided by this module has been included into newer versions of the Features module. So as long as your Features module is up-to-date you should be good to go. The concepts from this video do still apply.
Additional resources
Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)
https://github.com/DrupalizeMe/drupalize-lullablog (GitHub.com)
This video describes a number of the most important configuration files within MAMP that are commonly edited in order to run a web application like Drupal locally. There's a brief tour of the http.conf file, and then walks through the process of upping the max_allowed_packet limit from 1M to 2M within the my.cnf, which was a renamed copy of the my-large.cnf file. It's also a good idea to turn off binary logging on your local development by commenting out log-bin and binlog_format lines within this my.cnf file. Addi then shows you how to raise the PHP memory unit from 32M to 256 by opening the php.ini file and changing the memory_limit value. Finally, she shows you how to use MAMP's version of PHP and MySQL from the commandline by editing your .bash_profile and adding a number of paths to your default PATH. Note: The configuration files may have moved between versions of MAMP. You should check for where the MySQL cnf files are for your specific version of MAMP. A quick Google search can probably get you set in the right direction.
To learn how to install MAMP, see the Installing MAMP Server tutorial.
Additional resources
More information on Development Environments
This video walks through the process of downloading and doing the initial configuration of WampServer, which is Apache, MySQL and PHP for Windows. It shows how to turn it on and off, as well as how to get files to show up from the localhost server.
Next up: WampServer Configuration.
Notes:
If after installing WAMP you get a 404 error, make sure the server is actually running. Navigate to wampserver > apache > service > install service... opens prompt, hit enter... wampserver icon turns green.
Additional resources
More information on Development Environments
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
This video shows you how to download and do the initial setup of MAMP, which is Apache, MySQL and PHP for Macintosh. It shows some basic configuration tweaks to change the port from 8888 to the default of 80 so that you can just visit the localhost in the browser and get your Drupal installation to appear. It also provides a general orientation to MAMP, and some other initial configuration setting changes.
Next up: MAMP Server Configuration
Additional resources
More information on Development Environments
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.
In this lesson, we will cover the basics of getting code into version control using the Mac app "Tower" and then making the first commit and pushing it to the remote repository we will setup on beanstalkapp.com.
Features is a module which generates modules for us. You can then extend that module just as you would any other Drupal module. In this video we'll add some additional code to our feature to make it more complete for our needs, outside of the realm of what Features itself can provide.
The features module (and the drush command) are pretty smart about not overwriting custom changes, and your chances of overwriting your custom code are pretty slim. When features exports a module it creates a .module file with only one line of code in it. Which is an include for another file: mymodule.features.inc. Features then puts all of the automatically generated code into this included file. When you regenerate or update a feature it just uses the existing mymodule.module file which maintains any code that you wrote, and then regenerates the mymodule.features.inc and associated files.
Additional resources
Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)
https://github.com/DrupalizeMe/drupalize-lullablog (GitHub.com)
James Sansbury defines Features (a module that helps organize site components and applications for specific use cases), as distinct from Nodes and other forms of site content.
Prerequisites
This series assumes that you can install Drupal 7, create a basic content type, create a basic view, and use Drush. See the following resources if you need a refresher:
- Create a New Content Type
- Creating a New View
- Introduction to Drush series
- Installing Drupal with Drush
Additional resources
Features project (Drupal.org)
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)
Drupal 7 co-maintainer Angie Byron gives a overview of some of the new Drupal 7 features, themes and user interface. She is joined by Nate Haug, Jeff Robbins, Jeff Eaton and Kent Bye who also provide a lot of insights through dynamic conversation, questions, and a fast-paced, hands-on tour of the major highlights of the new Drupal 7 release.
This video walks through some of the most common and important server configurations for running a local development server on WAMP. This will show you how to enable the Apache rewrite_module through the WampServer graphical user interface, and where the http.conf configuration file is located. It also walks through the process of creating aliased folders so that you can organize your files in your directory structure and still have it available in the localhost via your browser. The video also shows how to change the max_allowed_packet from 1M to 2M via the my.ini file, and how to up the memory limit from 128M to 256M via the php.ini file stored in the bin folder within the Apache version folder.
To learn how to install WampServer, see the Installing Wampserver tutorial.
Additional resources
More information on Development Environments