array( 'title' => t('Rounded corners'), 'description' => t('Presents the panes or panels with a rounded corner box around them'), 'render panel' => 'panels_rounded_corners_style_render_panel', 'render pane' => 'panels_rounded_corners_style_render_pane', 'settings form' => 'panels_rounded_corners_style_settings_form', ), ); } // --------------------------------------------------------------------------- // Panels style plugin callbacks. /** * Render callback. * * @ingroup themeable */ function theme_panels_rounded_corners_style_render_panel($display, $panel_id, $panes, $settings) { $output = ''; // Determine where to put the box. If empty or 'pane' around each pane. If // 'panel' then just around the whole panel. $where = empty($settings['corner_location']) ? 'pane' : $settings['corner_location']; $print_separator = FALSE; foreach ($panes as $pane_id => $pane) { // Add the separator if we've already displayed a pane. if ($print_separator) { $output .= '
'; } $text = panels_render_pane($pane, $display->content[$pane_id], $display); if ($text) { $output .= ($where == 'pane') ? panels_rounded_corners_box($text) : $text; } // If we displayed a pane, this will become true; if not, it will become // false. $print_separator = (bool) $text; } if ($where == 'panel') { $output = panels_rounded_corners_box($output); } panels_add_rounded_corners_css($display, $where); return $output; } function panels_add_rounded_corners_css($display, $where) { static $displays_used = array(); if (empty($displays_used[$display->css_id])) { panels_rounded_corners_css($display, $where); $displays_used[$display->css_id] = TRUE; } } /** * Render callback for a single pane. */ function theme_panels_rounded_corners_style_render_pane($content, $pane, $display) { $output = theme('panels_pane', $content, $pane, $display); if (!$output) { return; } // Just stick a box around the standard theme_panels_pane. $output = panels_rounded_corners_box($output); panels_add_rounded_corners_css($display, 'pane'); return $output; } /** * Settings form callback. */ function panels_rounded_corners_style_settings_form($style_settings) { $form['corner_location'] = array( '#type' => 'select', '#title' => t('Box around'), '#options' => array( 'pane' => t('Each pane'), 'panel' => t('Each panel'), ), '#default_value' => (isset($style_settings['corner_location'])) ? $style_settings['corner_location'] : 'ul', '#description' => t('Choose whether to include the box around each pane (piece of content) or panel (each column or region)'), ); return $form; } /** * Generates the dynamic CSS. * * @param $display * A Panels display object. * @param $where * String indicating where the rounded corners should be applied, either * 'pane' or 'panel'. */ function panels_rounded_corners_css($display, $where = 'pane') { $idstr = empty($display->css_id) ? '.rounded_corner' : "#$display->css_id"; $url = panels_get_path('styles/corners', TRUE); $css = <<