Skip to content

Commit

Permalink
INTERIM-163 Add plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Booher committed Apr 26, 2018
1 parent dd49930 commit 6743092
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
49 changes: 49 additions & 0 deletions panels/styles/add_class.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

// Plugin definition
$plugin = array(
// Title and description of the plugin
'title' => t('Add Class'),
'description' => t('Add a class to a panel.'),
// Define a theme function for this plugin
'render region' => 'add_class_style_render_region',
// This defines the settings form for the plugin
'settings form' => 'add_class_style_settings_form',
);

/**
* Settings form callback.
*/
function add_class_style_settings_form($settings) {
$form['class'] = array(
'#type' => 'textfield',
'#title' => t('CSS Classes'),
'#description' => t('Enter CSS classes for this style. Separate multiple classes by spaces.'),
'#default_value' => (isset($form['class'])) ? $form['class'] : '',
);

return $form;
}

/**
* Region render callback.
*
* Please note that it's a theme function
* and has to start with 'theme_' prefix.
*/
function theme_add_class_style_render_region($vars) {

// Variable $vars['settings'] gets the class added in the form.
$output = '<div class="'. $vars['settings']['class'] .'">';

// Variable $vars['panes'] contains an array of all
// panel panes in current region. Collect them into
// variable.
foreach ($vars['panes'] as $pane) {
$output .= $pane;
}

$output .= '</div>';

return $output;
}
1 change: 1 addition & 0 deletions suitcase_interim.info
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ screenshot = 'screenshot.png'
base theme = 'omega'
version = '1.1.7'
plugins[panels][layouts] = panels/layouts
plugins[panels][styles] = panels/styles
regions[page_top] = 'Page Top'
regions[page_bottom] = 'Page Bottom'
regions[isu_menu] = 'ISU Menu'
Expand Down

0 comments on commit 6743092

Please sign in to comment.