Skip to content

Commit

Permalink
Merge branch '7.x-1.x' into megamenu-jgk
Browse files Browse the repository at this point in the history
  • Loading branch information
boznik committed May 16, 2017
2 parents 6bb4605 + 8ff9d30 commit 5b836fd
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 6 deletions.
70 changes: 70 additions & 0 deletions stanford_soe_regions.module
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ function stanford_soe_regions_define_regions() {
//'css' => drupal_get_path('module', 'stanford_soe_regions') . '/css/soe_regions.css',
'render_callback' => '_content_body_bottom_render_region',
);
$region['digital_magazine_menu'] = array(
'title' => 'Digital Magazine Menu',
//'js' => drupal_get_path('module', 'stanford_soe_regions') . '/js/stanford_soe_regions.js',
//'css' => drupal_get_path('module', 'stanford_soe_regions') . '/css/soe_regions.css',
'render_callback' => '_digital_magazine_menu_render_region',
);
$region['digital_magazine_megamenu'] = array(
'title' => 'Digital Magazine Megamenu',
'js' => drupal_get_path('module', 'stanford_soe_regions') . '/js/stanford_soe_regions_megamenu.js',
Expand Down Expand Up @@ -78,6 +84,15 @@ function _content_body_bottom_render_region($block_html, $block) {
return $output;
}

/**
* Helper function for rendering the blocks in this region.
*/
function _digital_magazine_menu_render_region($block_html, $block) {
$renderable_block = _block_get_renderable_array(array($block));
$output = drupal_render($renderable_block);
return $output;
}

/**
* Helper function for rendering the blocks in this region.
*/
Expand Down Expand Up @@ -124,3 +139,58 @@ function stanford_soe_regions_theme() {
),
);
}

/**
* Implements hook_form_alter().
*/
function stanford_soe_regions_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'ctools_export_ui_edit_item_form') {
//Since we are adding regions programmatically, we fix the order in the context reactions list here.
$order = array(
'#tree',
'#theme',
'admin_shortcuts',
'global_header',
'header',
'navigation',
'search_box',
'digital_magazine_menu',
'digital_magazine_megamenu',
'full_width_super_hero',
'fullwidth_top',
'main_top',
'main_upper',
'sidebar_first',
'highlighted',
'help',
'content_top',
'content_upper',
'content',
'content_row2',
'content_col2-1',
'content_col2-2',
'content_row3',
'content_col3-1',
'content_col3-2',
'content_col3-3',
'content_row4',
'content_col4-1',
'content_col4-2',
'content_col4-3',
'content_col4-4',
'content_lower',
'content_bottom',
'sidebar_second',
'main_lower',
'main_bottom',
'content_body_lower',
'full_width_middle',
'content_body_bottom',
'fullwidth_bottom',
'footer',
);
uksort($form['reactions']['plugins']['block']['blocks'], function($key1, $key2) use ($order) {
return (array_search($key1, $order) > array_search($key2, $order));
});
}
}
18 changes: 12 additions & 6 deletions templates/digital-magazine-page.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,24 @@
</div>
<!-- /#main-menu -->
<?php endif; ?>

<?php if ($page['digital_magazine_menu']): ?>
<div id="digital-magazine-menu" class="row-fluid fullwidth">
<div class="container"> <?php print render($page['digital_magazine_menu']); ?> </div>
</div>
<?php endif; ?>

<?php if ($page['digital_magazine_megamenu']): ?>
<div id="digital-magazine-megamenu" class="row-fluid fullwidth">
<div class="container"> <?php print render($page['digital_magazine_megamenu']); ?> </div>
</div>
<?php endif; ?>

<?php if ($page['fullwidth_top']): ?>
<div id="fullwidth-top" class="row-fluid fullwidth">
<div class="container"> <?php print render($page['fullwidth_top']); ?> </div>
</div>
<?php endif; ?>

<?php if ($page['digital_magazine_megamenu']): ?>
<div id="digital-magazine-megamenu" class="row-fluid fullwidth">
<div class="container"> <?php print render($page['digital_magazine_megamenu']); ?> </div>
</div>
<?php endif; ?>

<div id="main" class="clearfix main" role="main">
<?php if (!($is_front) && ($breadcrumb)): ?>
Expand Down

0 comments on commit 5b836fd

Please sign in to comment.