This PPT talks about theme and how we can develop module and do theming for your custome module.
This is presented in Drupal Camp Deccan at Hydrabad on 11/11/11 when Dries was India trip. It was knowledge sharing and getting to know fellow Drupalists. This was one amazing event and am sure many more will follow.
http://drupalcampdeccan.in/sessions/theming-best-practices-and-preprocess
Below are few media hives
Business Line:
http://www.thehindubusinessline.com/industry-and-economy/info-tech/article2619142.ece
Blogs:
http://www.devblogging.com/2011/11/11/drupal-making-waves-across-globe-h...
Deccan Chronicle:
http://www.deccanchronicle.com/tabloid/hyderabad/dr-dre-internet-652
9. Devel: dpm() Firebug: To inspect HTML and CSS, and prototype styles( http://getfirebug.com ) Web Developer Toolbar: Adds a menu and a toolbar to Firefox with various helpful web developer tools. https://addons.mozilla.org/en-US/firefox/addon/60 XDebug & NetBeans
13. Step1) hook_menu() implementation function drupalcamp_menu(){ $items['my-themeing-page'] = array( 'title' => 'General page callback', 'page callback' => 'drupalcamp_page_theming', 'access arguments' => array('access content'), 'type' => MENU_NORMAL_ITEM ); return $items; } Step2) hook_preprocess function drupalcamp_preprocess_ drupalcamp_page_theming (&$vars){ $vars['new_variable1'] = 'this is my first variableâ; }
14. Step3) hook_theme implementation function drupalcamp_theme(){ $items[' drupalcamp_page_theming '] = array( 'template' => 'drupalcamp-page-theming', 'arguments' => array(), 'access agruments' => TRUE ); return $items; } Note the underscores in the theme function name are replaced with hyphens when we create our template reference. Note also that, in theory, the template name does not have to match the theme function name, however, we have discovered through testing that if the template name is different from the theme function name then the theme may not recognise the template file when it is coped to the theme's template directory. I'm not sure if this is by design, but for safety's sake make sure the template file and the theme registration are the same in name.
15. Step 4) call theme() function function drupalcamp_page_theming (){ return theme('drupalcamp_page_theming'); } Step 5) Next job is to create our template file drupalcamp-page-theming.tpl.php <div class="my-theme"> This is my template. <?php print $new_variable1; ?> </div> Now if you clear the Drupal cache (see below) and we visit the page http://yoursite.com/my-themeing-page then we will see the output of our theme function
16. Ex 2: Page callback & theme This is similar to example 1 only difference is we added page callback => âthemeâ and deleted step4 Step1) hook_menu() implementation function drupalcamp_menu(){ $items['my-themeing-page'] = array( 'title' => 'General page callback', 'page callback' => âtheme', â page argumentsâ => array(âdrupalcamp_page_themingâ), 'access arguments' => array('access content'), 'type' => MENU_NORMAL_ITEM ); return $items;}
17. Step2) hook_theme implementation function drupalcamp_theme(){ $items['drupalcamp_page_theming'] = array( 'template' => 'drupalcamp-page-theming', 'arguments' => array(), 'access agruments' => TRUE ); return $items; } Step3) hook_preprocess function drupalcamp_preprocess_drupalcamp_page_theming(&$vars){ $vars['new_variable1'] = 'this is my first variable'; $vars['goto_back'] = l(âMy Link', âmy urlâ, array('attributes' => array('class' => 'orangeBtn'))); }
18. Ex 3: How to theme a form Step1) hook_menu() implementation function drupalcamp_menu(){ $items['form_theme'] = array( 'title' => 'How to implement theme with a form callbackâ, 'page callback' => 'drupal_get_form', 'page arguments' => array('drupalcamp_form'), 'access arguments' => array('access content'), 'type' => MENU_NORMAL_ITEM ); }