6d835f8bbce64600966be6492e794bc258ac4623
[project/panels.git] / plugins / style_bases / pane / pane_rounded_shadow / pane_rounded_shadow.inc
1 <?php
2 // $Id$
3
4 /**
5 * @file
6 * Definition of the style base for the rounded shadow box.
7 *
8 * This box is colorable, has rounded corners and a drop shadow.
9 */
10
11 $plugin = array(
12 'category' => t('Basic styles'),
13 'title' => t('Rounded shadow box'),
14 'module' => 'panels',
15 'type' => 'pane',
16 'css' => 'pane-rounded-shadow.css',
17 'icon' => 'icon.png',
18 'defaults' => array('header_font' => array(), 'text_font' => array(), 'padding' => array(), 'header_border' => array()),
19 'palette' => array(
20 'background' => array(
21 'label' => t('Background'),
22 'default_value' => '#FFFFFF',
23 ),
24 'text' => array(
25 'label' => t('Text'),
26 'default_value' => '#000000',
27 ),
28 'header-text' => array(
29 'label' => t('Header text'),
30 'default_value' => '#000000',
31 ),
32 'header-border' => array(
33 'label' => t('Header border'),
34 'default_value' => '#000000',
35 ),
36 ),
37 'actions' => array(
38 array('load', 'box', 'box-color.png'),
39 array('colorize', 'background'),
40 array('load', 'shadow', 'box-shadow.png'),
41 array('merge_from', 'box'),
42 array('slice', 'rounded-shadow-top-left-corner.png', 17, 49, 19, 19),
43 array('slice', 'rounded-shadow-top-right-corner.png', 473, 49, 19, 19),
44 array('slice', 'rounded-shadow-bottom-left-corner.png', 17, 442, 19, 19),
45 array('slice', 'rounded-shadow-bottom-right-corner.png', 473, 442, 19, 19),
46 array('slice', 'rounded-shadow-left-edge.png', 17, 60, 10, 10),
47 array('slice', 'rounded-shadow-right-edge.png', 474, 60, 18, 10),
48 array('slice', 'rounded-shadow-top-edge.png', 28, 49, 10, 10),
49 array('slice', 'rounded-shadow-bottom-edge.png', 28, 443, 10, 18),
50 array('slice', 'rounded-shadow-background.png', 150, 150, 1, 1),
51 ),
52
53 'theme' => 'pane_rounded_shadow',
54 'build' => 'panels_rounded_shadow_style_base_build',
55 // 'preview' => 'panels_stylizer_pane_preview',
56
57 'settings form' => 'panels_pane_rounded_shadow_style_settings',
58 'settings form submit' => 'panels_pane_rounded_shadow_style_settings_submit',
59 'build' => 'panels_pane_rounded_shadow_style_base_build',
60 );
61
62 function template_preprocess_pane_rounded_shadow(&$vars) {
63 $vars['classes'] = $vars['content']->css_class;
64 $vars['content']->css_class = '';
65
66 $vars['output'] = theme('panels_pane', $vars);
67 }
68
69 function panels_pane_rounded_shadow_style_settings(&$form, &$form_state) {
70 $form['header_font'] = array();
71 ctools_stylizer_font_selector_form($form['header_font'], $form_state, t('Header font'), $form_state['settings']['header_font']);
72
73 $form['header_border'] = array();
74 ctools_stylizer_border_selector_form($form['header_border'], $form_state, t('Header border'), $form_state['settings']['header_border']);
75
76 $form['text_font'] = array();
77 ctools_stylizer_font_selector_form($form['text_font'], $form_state, t('Text font'), $form_state['settings']['text_font']);
78
79 $form['padding'] = array();
80 ctools_stylizer_padding_selector_form($form['padding'], $form_state, t('Padding'), $form_state['settings']['padding']);
81 }
82
83 function panels_pane_rounded_shadow_style_settings_submit(&$form, &$form_state) {
84 ctools_stylizer_font_selector_form_submit($form['header_font'], $form_state, $form_state['values']['header_font'], $form_state['settings']['header_font']);
85
86 ctools_stylizer_font_selector_form_submit($form['text_font'], $form_state, $form_state['values']['text_font'], $form_state['settings']['text_font']);
87
88 ctools_stylizer_padding_selector_form_submit($form['padding'], $form_state, $form_state['values']['padding'], $form_state['settings']['padding']);
89
90 ctools_stylizer_border_selector_form_submit($form['header_border'], $form_state, $form_state['values']['header_border'], $form_state['settings']['header_border']);
91
92 }
93
94 function panels_pane_rounded_shadow_style_base_build($plugin, $settings, &$css, $replacements) {
95 ctools_stylizer_font_apply_style($css, '%style .pane-title', $settings['header_font']);
96 ctools_stylizer_border_apply_style($css, '%style .pane-title', $settings['header_border'], '%header-border', 'bottom');
97 ctools_stylizer_font_apply_style($css, '%style .pane-content', $settings['text_font']);
98 ctools_stylizer_padding_apply_style($css, '%style', $settings['padding']);
99 }
100