Last active
August 29, 2016 13:31
-
-
Save v1talii-dev/5bf05148110a0ff923c44a49813ae500 to your computer and use it in GitHub Desktop.
D7: theme template in module
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
<?php | |
# ------------------------------------------------------------------------------ | |
# test.module | |
# ------------------------------------------------------------------------------ | |
/** | |
* Implements hook_theme(). | |
*/ | |
function test_theme() { | |
return array( | |
'test_panel' => array( | |
'variables' => array(), | |
'template' => 'test-panel', | |
'path' => drupal_get_path('module', 'test') . '/templates' | |
), | |
); | |
} | |
// Some callback function.. | |
function test_page() { | |
$template = theme('test_panel', array( | |
'data' => array( | |
'test' => 'data' | |
) | |
); | |
return $template; | |
} | |
# ------------------------------------------------------------------------------ | |
# templates/test-panel.tpl.php | |
# ------------------------------------------------------------------------------ | |
<code><?php print_r($data); ?></code> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment