Skip to content

Instantly share code, notes, and snippets.

@moonray
Created October 29, 2010 20:17
Show Gist options
  • Save moonray/654319 to your computer and use it in GitHub Desktop.
Save moonray/654319 to your computer and use it in GitHub Desktop.
A skinr include.
<?php
/**
* Implements hook_skinr_info().
*
* Define the API version of skin(s). This is required when creating a new skin.
* The theme or module version
*
* The "hook" prefix is substituted with the name of the module or theme that
* implements it, e.g. THEMENAME_PLUGINNAME_skinr_info(), or
* MODULENAME_PLUGINNAME_skinr_info().
*/
function skinr_provided_skin_skinr_info() {
return array(
'skinr api' => '2.0',
);
}
/**
* Implements hook_skinr_groups().
*
* Optional. Defines group(s) that will contain skins. Groups are form element
* containers used to organize skins categorically.
*
* Each group name must be unique and should be prefixed by the theme or module
* name implementing it.
*
* If you do not define a group, your skins will appear in Skinr's default
* group, which is labeled "General."
*
* The "hook" prefix is substituted with the name of the module or theme that
* implements it, e.g. THEMENAME_PLUGINNAME_skinr_groups(), or
* MODULENAME_PLUGINNAME_skinr_groups().
*/
function skinr_provided_skin_skinr_groups() {
$groups['skinr_provided_skin_group_a'] = array(
'#title' => t('Box Styles'),
'#description' => t('Choose one or more styles to apply to this element. Click <a href="@help">here</a> for help.', array('@help', 'admin/advanced_help/zen_boxes')),
// Meta information about the skin to display to administrators.
'#admin_title' => t('Zen Boxes'),
'#admin_description' => t('Contains 2 skins to manipulate the background and font size of the container it\'s applied to.'),
// Skinr provided defaults.
'#weight' => NULL,
);
);
return $groups;
}
/**
* Implements hook_skinr_skins().
*
* Required.
*
* The "hook" prefix is substituted with the name of the module or theme that
* implements it, e.g. THEMENAME_PLUGINNAME_skinr_skins(), or
* MODULENAME_PLUGINNAME_skinr_skins().
*/
function skinr_provided_skin_skinr_skins() {
$skins['skinr_provided_skin_background_color'] = array(
'#title' => t('Text color'), // Default is ''.
'#description' => t('Description of a skin'),
'#type' => 'select', // Default is "checkboxes".
'#group' => 'zen_boxes', // Default is ''.
'#weight' => NULL, // Form API weight, per group
'#screenshot' => 'screenshot.png', // This path is relative to the path of this file
'#features' => array (
'block',
'panels_display',
'panels_pane',
'panels_panel',
'views_view',
),
'#stylesheets' => array(
array(
'css/provided_skin.css', // This path is relative to the path of this file
array('type' => 'file', 'group' => CSS_DEFAULT, 'media' => 'all', 'browsers' => array('IE' => 'gte IE 8')), // These options are passed to drupal_add_css()
),
'css/provided_skin_two.css', // No additional options required
),
'#scripts' => array(
'js/provided_skin.js', // This path is relative to the path of this file; no additional options required
array(
'js/provided_skin_two.js', // This path is relative to the path of this file
array('type' => 'file', 'scope' => 'footer', 'group' => JS_DEFAULT, 'defer' => TRUE), // These options are passed to drupal_add_js()
),
),
'#templates' => array(
'skinr_provided_skin_background_color.tpl.php', // This path is relative to the path of this file
),
'#options' => array (
'boxes-bw' => array (
'#label' => t('Black on white'),
'#class' => 'boxes-bw',
'#stylesheets' => array(
'all' => array('css/provided_skin.css'), // This path is relative to the path of this file
),
'#scripts' => array(
'js/provided_skin.js', // This path is relative to the path of this file
),
),
'boxes-wb' => array (
'#label' => t('White on black'),
'#class' => 'boxes-wb',
),
),
'#default_status' => 0,
// The options below are programatically added.
'#status' => array( // Overrides #default_status on a per theme basis
'bartik' => 1,
'fusion' => 1,
),
'#source' => array( // The implementing module or theme
'#type' => 'theme', // Options: module | theme
'#name' => 'zen', // The name of the module or theme
'#plugin' => 'boxes',
),
);
return $skins;
}
/**
* Implements hook_skinr_skins_alter().
*
* @param $skins
* An array containing skins and their properties.
*/
function skinr_provided_skin_skinr_skins_alter($skins) {
unset($skins['skinr_provided_skin_background_color']['#features']['panels_pane']);
}
/**
* Implements hook_skinr_groups_alter().
*
* @param $groups
* An array containing groups and their properties.
*/
function skinr_provided_skin_skinr_groups_alter($groups) {
$groups['skinr_provided_skin_group_a']['#weight'] = 10;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment