Skip to content

Instantly share code, notes, and snippets.

@khalib
Created May 13, 2014 17:54
Show Gist options
  • Select an option

  • Save khalib/749a3d828cda6fb51bd4 to your computer and use it in GitHub Desktop.

Select an option

Save khalib/749a3d828cda6fb51bd4 to your computer and use it in GitHub Desktop.
<div class="coming-soon">
<h1><?php print $node->title; ?></h1>
This is a coming soon review
</div>
<div class="review">
<?php if ($is_coming_soon) ?>
<?php print $coming_soon; ?>
<?php endif; ?>
<?php if ($is_module_review) ?>
<?php print $module_review; ?>
<?php endif; ?>
</div>
<div class="module-review">
<h1><?php print $node->title; ?></h1>
This is a module review
</div>
<?php
function mymodule_theme {
return array(
'mymodule_main_page' => array(
'arguments' => array(),
'template' => 'templates/main-page',
),
'mymodule_coming_soon' => array(
'arguments' => array('node' => NULL),
'template' => 'templates/coming-soon',
),
'mymodule_module_review' => array(
'arguments' => array('node' => NULL),
'template' => 'templates/module-review',
),
);
}
function mymodule_preprocess_node(&$variables) {
$node = $variables['node'];
if ($node->type == 'mymodule') {
$variables['is_coming_soon'] = $is_coming_soon;
$variables['is_module_review'] = $is_module_review;
switch ($variables['view_mode']) {
case 'full':
if ($is_coming_soon) {
$variables['coming_soon'] = theme('mymodule_coming_soon', array('node' => $node));
} else if ($is_module_review) {
$variables['module_review'] = theme('mymodule_module_review', array('node' => $node));
}
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment