Projet

Général

Profil

Paste
Télécharger (1,78 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / themes / adaptivetheme / at_core / layouts / core / two_sidebars_right / two_sidebars_right.inc @ 74f6bef0

1
<?php
2

    
3
/**
4
 * @file
5
 * Implimentation of a Page Layout Plugin for Adaptivetheme.
6
 *
7
 * @see three_col_grail.inc for detailed documentation.
8
 */
9
function two_sidebars_right() {
10
  $page_layout['two_sidebars_right'] = array(
11
    'title'    => t('Two Sidebars Right'),
12
    'category' => t('AT Core layout'),
13
    'method'   => 'two_sidebars_right',
14
    'type'     => 'page_layout',
15
    'device_groups' => array(
16
      'bigscreen',
17
      'tablet_landscape',
18
     ),
19
  );
20

    
21
  return $page_layout;
22
}
23

    
24
/**
25
 * CSS Builder for the two_sidebars_right layout.
26
 * Positions both sidebars to the right of the main content column.
27
 *
28
 * @param $sidebar_first, an arbitary numeric value.
29
 * @param $sidebar_second, an arbitary numeric value.
30
 * @param $sidebar_unit, a value unit, one of px, em or %.
31
 */
32
function two_sidebars_right_layout($sidebar_first, $sidebar_second, $sidebar_unit) {
33

    
34
  $left = 'left';
35
  $right = 'right';
36

    
37
  $content_margin = $sidebar_second + $sidebar_first . $sidebar_unit;
38
  $sidebar_first  = $sidebar_first . $sidebar_unit;
39
  $sidebar_second = $sidebar_second . $sidebar_unit;
40
  $push_left      = $sidebar_first;
41
  $push_right     = $sidebar_second;
42
  $left_margin    = $content_margin;
43
  $right_margin   = $sidebar_second;
44

    
45
  $styles = <<<EOF
46
#content-column,.content-column,div.sidebar {float: left; clear: none}
47
.two-sidebars .content-inner {margin-$right: $content_margin; margin-$left: 0}
48
.sidebar-first .content-inner {margin-$right: $push_left; margin-$left: 0}
49
.sidebar-second .content-inner {margin-$right: $push_right; margin-$left: 0}
50
.region-sidebar-first {width: $sidebar_first; margin-$left: -$left_margin}
51
.region-sidebar-second {width: $sidebar_second; margin-$left: -$right_margin}
52
.sidebar-first .region-sidebar-first {width: $sidebar_first; margin-$left: -$sidebar_first}
53
EOF;
54

    
55
  return $styles;
56
}