Drupal 7 General¶
Books¶
- The programmer’s guide to drupal by Jennifer Hodgon (also with a git repository)
- Drupal 7 Development by Example by Kurt Madel
- Drupal 7 Module Development by Matt Butcher
- Maybe interesting Drupal 7 Themes by Ric Shreves
Hompepages¶
- Drupal Example Project with a well documented API
- Site for evaluating drupal modules
Useful Modules¶
Drupal 7 Module Building¶
- Drupal 7 Custom Module Development with Jon Peck
- Drupal 7 Essential Training with Tom Geller
- Drupal 7: Reporting and Visualizing Data with Tom Geller
Drupal Receipes¶
Rendered page¶
Make in your module an implementation of hook_menu, specifying the path of your page. Here you can define a function call (e.g. page_call_info()), specifying what and how to render:
# Item of hook_menu
$items['commitchanges'] = array(
'title' => 'Commit changes',
'page callback' => 'flat_deposit_ui_view_info',
'access callback' => TRUE,
'page arguments' => array(
'content' => 'Under construction'),
Drupal 7 Theming¶
Theming is one of the major issues of the drupal framework, particular if you think of this framework as a gigantic wrapper. For sure, Drupal does much more than that, but in the end, what you see is a in HTML-rendered homepage, so it is good to know something about rendering
Render arrays¶
Render arrays are arrays containing fields that are used to render different content. The most basis type is the markup type, containing with hard coded content. You can specify the output as it is shown on a HTML-page.
'link_upload' => array(
'#type' => 'markup',
'#prefix' => '<div>',
'#markup' => '<a href="/drupal/user/' . $GLOBALS['user']->uid . '/imce" title="Upload data"><img title="Upload data" alt="Upload data" src="/drupal/sites/default/files/Upload.png"/></a><br/>',
'#suffix' => </div>')
But there are also a lot of other types. Depending on the type of element which needs to be rendered (e.g. tables) these may have an theme function that can be called to wrap the content of the array in a certain format. An overview of all available functions are here
Videos (google render arrays drupal 7 tutorial):
- Themes tutorial by Heather James
- Drupal 7 renderable arrays by Code Carate
Pages:
Books:
all the resources mentioned here Books)
Form API¶
The form api is an important means to interact with the user. You can define for example action buttons and use them to trigger certain events. Normally, this procedure involves several steps.
- Create a function containing your form
- Call this form from your menu
- Create an additional form_validate function
- Create a form_submit function
Resources: