-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nick Booher
committed
Apr 26, 2018
1 parent
dd49930
commit 6743092
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters