Projet

Général

Profil

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

root / drupal7 / sites / all / themes / mayo / layouts / core / two_sidebars_left / two_sidebars_left.inc @ d7f58da2

1
<?php
2

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

    
20
  return $page_layout;
21
}
22

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

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

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

    
44
  $styles = <<<EOF
45
.two-sidebars #content .section {margin-$left: $content_margin; margin-$right: 0}
46
.one-sidebar #content .section {margin-$left: $content_margin_one_sidebar; margin-$right: 0}
47
#sidebar-first .section {margin-left: 0; margin-right: 10px;}
48
#sidebar-second .section {margin-left: 0; margin-right: 10px;}
49
#sidebar-first {width: $sidebar_first; margin-$left: -100%}
50
#sidebar-second {width: $sidebar_second; margin-$left: -100%}
51
.two-sidebars #sidebar-second {width: $sidebar_second; position: relative; $left: $push_right}
52
EOF;
53

    
54
  return $styles;
55
}