Drupal development
needs refactoring to work with theming
Basics
- Drupal's basic building blocks - the search for core, Ronald Ashri, Nov 2009
- Drupal programming from an object-oriented perspective
- Drupal as an Application Development Framework - great dev overview video, shame about the audio
- g.d.o: PHP
Architecture
- Drupal dev docs - "Newcomers to Drupal development should read the conceptual information provided in the 'Components of Drupal' section, and then proceed to examine one of the heavily-documented example modules below. The examples are fully-functioning Drupal modules, so you can download them from the contributions repository and alter them as you experiment."
- Preying on the drupal_alter() - API overview video. somewhat quiet sound. [1]
Modules
CLI
Coding
dpm()
- http://drupal.org/project/inspect - moar info than devel?
- http://drupal.org/project/schema - db schema infos
- http://drupal.org/project/examples - various examples
- http://drupal.org/project/model - entity models
- http://drupal.org/project/module_builder - joachim's
- http://drupal.org/project/coder - use when writing modules
- http://drupal.org/project/drupalcs - code sniffer
- http://drupal.org/project/simpletest - testing API modeled after the SimpleTest PHP library
- http://drupal.org/project/drupal_developer - developer orientated distro
Admin
- http://drupal.org/project/admin_menu - better menu system all-round
- http://drupal.org/project/views_system - create customized views of modules, themes, and theme engines that are or have been installed in Drupal's file system
- http://drupal.org/project/drupal_tweaks - doesn't look worth it?
- http://drupal.org/project/journal - track config changes - for multi admin sites?
Content
Module Admin
- http://drupal.org/project/update_notifications_disable - overrides update status even if not enabled. needs a cache clear to start working.
Coding
- Beginning Drupal Module Development or How I Wrote the Cacheflusher Module (Part 2) - has a good hook overview from a module perspective
Patches
patch -p1 < path/file.patch
or
git apply path/file.patch
Hooks
"Drupal's module system is based on the concept of "hooks". A hook is a PHP function that is named foo_bar(), where "foo" is the name of the module (whose filename is thus foo.module) and "bar" is the name of the hook. Each hook has a defined set of parameters and a specified result type.
"To extend Drupal, a module need simply implement a hook. When Drupal wishes to allow intervention from modules, it determines which modules implement a hook and calls that hook in all enabled modules that implement it."
Menu system (path)
- How the menu system works (a Drupal how-to) - how the menu system translates paths to callback functions
Content
Entities
An entity is a kind of content stack. An entity base table is tied to fields using bundles. Entity types include node, comment, taxonomy term, user profile, organic group, etc. Entity types can allow bundling or not (creating types of node node vs. users, though see the Profile 2 module). Fields are used to store and display various data types, and can be reused across bundles and entities.
- http://www.slideshare.net/ronald_istos/drupal-entities-emerging-patterns-of-usage
- http://www.slideshare.net/erikwebb/drupal-7-and-entities-7036807
hook_entity_info - "Inform the base system and the Field API about one or more entity types."
- http://www.trellon.com/content/blog/creating-own-entities-entity-api
- http://www.slideshare.net/ronald_istos/how-to-make-entities-and-influence-drupal-emerging-patterns-from-drupal-contrib
- http://bxl2011.drupaldays.org/node/313 - fago
Ctools
Forms
For beyond basic content types field layouts;
- http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html/7 - programmer's reference to the Drupal Form API
function milk_form_alter(&$form, &$form_state, $form_id) { if ($form_id == 'contact_node_form') { $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Send'), ); } }
- http://www.advomatic.com/blogs/jack-haas/notable-changes-to-theming-drupal-7 Notable changes to theming in Drupal 7] - Form Overrides section has another perspective on the basics
Menus
JavaScript
- JavaScript hygiene in Drupal 7 - Sep 12, 2011
Video
- Drupal 7 JavaScript for Developers - good video
Adding a JS file
In theme .info;
scripts[] = scriptfile.js
In template.php;
drupal_add_js() first paramater path second paramater (goes through as 'type: ' array item, defaults to file) file, setting, inline, external default: preprocess: true, everypage: true, weight:
$element['#attached']['js']
Drupal JS API and Behaviours
Drupal has an API for passing information between PHP and JS. Drupal.js sets up Drupal namespace.
Render Array
PHP sent by JSON to change content.