stylizer.module in Chaos Tool Suite (ctools) 6
Same filename and directory in other branches
Stylizer module
This module allows styles to be created and managed on behalf of modules that implement styles.
The Stylizer tool allows recolorable styles to be created via a miniature scripting language. Panels utilizes this to allow administrators to add styles directly to any panel display.
File
stylizer/stylizer.moduleView source
<?php
/**
* @file
* Stylizer module
*
* This module allows styles to be created and managed on behalf of modules
* that implement styles.
*
* The Stylizer tool allows recolorable styles to be created via a miniature
* scripting language. Panels utilizes this to allow administrators to add
* styles directly to any panel display.
*/
/**
* Implementation of hook_perm()
*/
function stylizer_perm() {
return array(
'administer stylizer',
);
}
/**
* Implementation of hook_ctools_plugin_directory() to let the system know
* we implement task and task_handler plugins.
*/
function stylizer_ctools_plugin_directory($module, $plugin) {
// Most of this module is implemented as an export ui plugin, and the
// rest is in ctools/includes/stylizer.inc
if ($module == 'ctools' && $plugin == 'export_ui') {
return 'plugins/' . $plugin;
}
}
/**
* Implementation of hook_panels_dashboard_blocks().
*
* Adds page information to the Panels dashboard.
*/
function stylizer_panels_dashboard_blocks(&$vars) {
$vars['links']['stylizer'] = array(
'title' => l(t('Custom style'), 'admin/build/stylizer/add'),
'description' => t('Custom styles can be applied to Panel regions and Panel panes.'),
);
// Load all mini panels and their displays.
ctools_include('export');
ctools_include('stylizer');
$items = ctools_export_crud_load_all('stylizer');
$count = 0;
$rows = array();
$base_types = ctools_get_style_base_types();
foreach ($items as $item) {
$style = ctools_get_style_base($item->settings['style_base']);
if ($style && $style['module'] == 'panels') {
$type = $base_types[$style['module']][$style['type']]['title'];
$rows[] = array(
check_plain($item->admin_title),
$type,
array(
'data' => l(t('Edit'), "admin/build/stylizer/list/{$item->name}/edit"),
'class' => 'links',
),
);
// Only show 10.
if (++$count >= 10) {
break;
}
}
}
if ($rows) {
$content = theme('table', array(), $rows, array(
'class' => 'panels-manage',
));
}
else {
$content = '<p>' . t('There are no custom styles.') . '</p>';
}
$vars['blocks']['stylizer'] = array(
'title' => t('Manage styles'),
'link' => l(t('Go to list'), 'admin/build/stylizer'),
'content' => $content,
'class' => 'dashboard-styles',
'section' => 'left',
);
}
Functions
Name | Description |
---|---|
stylizer_ctools_plugin_directory | Implementation of hook_ctools_plugin_directory() to let the system know we implement task and task_handler plugins. |
stylizer_panels_dashboard_blocks | Implementation of hook_panels_dashboard_blocks(). |
stylizer_perm | Implementation of hook_perm() |