Last active
August 29, 2015 14:19
-
-
Save isramv/59a3669e1eabd98ed8e5 to your computer and use it in GitHub Desktop.
How to theme a block Drupal 7 example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Function | |
*/ | |
function myfunction() { | |
$variables = array( | |
'message' => 'Hi Bitches!', | |
'name' => 'Monk' | |
); | |
return theme('mobile-nav', $variables); | |
} | |
/** | |
* Implements hook_theme(); | |
*/ | |
function ooyala_mobilenav_theme() { | |
return array( | |
'mobile-nav' => array( | |
'template' => 'mobile-nav' //Name of the tpl should be mobile-nav.tpl.php | |
), | |
'variables' => array( | |
'message' => '', | |
'name' => '' | |
) | |
); | |
} | |
//The mobile-nav.tpl.php | |
<h3><?php echo $message; ?> this is <?php echo $name; ?></h3> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment