Sven Aas
Lead Web Applications Developer
Mount Holyoke College
@svenaas
My background: undergrad, grad, professional
Lots of languages, even a little PHP, but not much (even now)
(PHP, in my opinion, makes it too easy for inexperienced programmers to get results without proceeding wisely.)
My Drupal Experience
Started exploring Drupal in 2010
2011: DrupalCon Chicago and Training
2012: DrupalCon Denver and Site Launch
2014: DrupalCon Austin
When I started at Mount Holyoke in 2006 they were using another CMS.
Eventually the time came to reassess the CMS situation. We evaluated
quite a few tools before deciding that Drupal seemed like the best fit
for us. (This was an interesting process and topic — feel free to come
talk to me about it later.)
Then: conferences
YESTERDAY I was still in Texas. I've hardly had time to change my clothes.
My Core Message
You can do this
Always be learning—it's why I'm in this field.
Higher Ed. HighEdWeb. Student Mentoring.
You can do this. It's really not that hard.
Drupal 7
Not Drupal 6 — Drupal 7's been out for three and a half years.
Not Drupal 8 — It won't be out for at least a year
Architecture ([Over]simplified)
On every HTTP request ...
index.php is requested
bootstrap.inc is loaded along with other core code
all [enabled] module and theme code is loaded
index.php passes request to a handler
Callback API
Exposed by Drupal Core and some modules
Event-based
All modules can implement hook handlers
All modules' hook implementations get called
Routing — associate a URL with a method
Permissions – whether a URL can be accessed
Menus
Content data and metadata
Context
Messy: inconsistent and overcomplicated
Anatomy of a Module
my_module.info
my_module.module
my_module.install
my_module.info
name = My Module
description = Make everything beautiful
package = My Package
core = 7.x
; This is a comment
dependencies[] = entity
stylesheets[all][] = css/my_module.css
files[] = my_module_extra_bits.inc
my_module.install
<?php
/**
* @file
* Contains install and update functions for My Module.
*/
/**
* Implements hook_install().
*/
function my_module_install() {
// Do installation stuff
}
This is a PHP file.
There's an opening tag but no closing tag.
my_module.install functions
my_module_install()
my_module_schema()
my_module_update_7001()
my_module_uninstall()
All method names begin with the machine name of the module
my_module.module
<?php
/**
* @file
* Make everything beautiful
*/
/**
* Page callback for administrative settings
*/
function my_module_admin() {
// Do menu stuff
}
my_module.module functions
my_module_admin()
my_module_menu()
my_module_permission()
Other hook implementations
Internal functions
watchdog / log
watchdog()
Shows up in administrative UI at Reports / Recent log messages (admin/reports/dblog)
dpm prints a variable recursively in the message area of the page
Not every page has a message area (but there are many alternative functions described at Debugging Drupal and elsewhere: dpr, dvm, etc)
Inspector
DOM Inspection
Network requests
JavaScript console
Usage and tools will vary with browser
You may have to turn this tool on, install extensions, etc
Learn how it works with your development browser(s) of choice
Compatibility
Independence
Dependencies
Play well with others.
State your needs clearly and correctly, both in .install and in documentation.
Empowerment
Many Drupal customizations can be implemented in custom modules much more easily than you think.
You can do this
Your students can do this