You are here

function hook_fusion_apply_skin_info in Fusion Accelerator 7

Same name and namespace in other branches
  1. 7.2 fusion_apply/fusion_apply.api.php \hook_fusion_apply_skin_info()

Define the skin(s) for this plugin.

Each skin definition consists of properties that define its form element and settings that are needed to make it work, such as the class(es) Fusion Apply should apply, which files it should load, whether or not it should be disabled by default and which theme hook(s) it was designed to work with.

Each skin name must be unique. Skins cannot have the same name even if they are located in different plugins. It is recommended to prefix the name of each skin with the name of the theme or module implementing it.

Skin settings:

  • title (required): Title of the skin form element.
  • description (optional): Description of the skin form element.
  • group (optional): The group the skin is attached to; defaults to a Fusion Apply provided group labeled "General."
  • type (optional): The type of form element. Allowed values:
    • checkboxes (default): Useful when single or multiple options can be chosen. This type does not need to be set manually. Fusion will apply it by default.
    • select: Useful when a single option can be chosen, but many exist.
    • radios: Useful when a single option can be chosen and only a few options exist.
  • weight (discouraged): Sets the weight of the skin inside the group; NULL by default. weight should not be set on each individual skin. Instead, it should be used sparingly where positioning a skin at the very top or bottom is desired.
  • attached (optional): A array containing information about CSS and JavaScript files the skin requires. Each entry is an array keyed by type:

    • css (optional): Maps to the functionality of drupal_add_css() with one exception: paths are automatically assumed relative to the plugin directory, unless external. Examples:

      • Simple: 'css' => array('css/skin-name.css')
      • Advanced: 'css' => array( array('css/skin-name-ie.css', array( 'media' => 'screen', 'browsers' => array('IE' => 'lte IE 8'), ), )
    • js (optional): Maps to the functionality of drupal_add_js() with one exception: paths are automatically assumed as relative to the plugin directory, unless external. Examples:

      • Simple: 'js' => array('js/skin-name.js')
      • Advanced: 'js' => array( array( 'js/skin-name-advanced.js', array( 'scope' => 'footer', 'group' => JS_THEME, ), )
  • options (required): An array containing one or more options (also arrays) for the user to choose from when applying skins. Each option key should be a machine name describing the option. An option should including the following keys:

    • title (required): The option label.
    • class (required): An array containing one or more classes the skin should apply. All classes should be entered as an array: For example: 'class' => array('class-b', 'class-b')
    • attached (optional): Same syntax as above, but applies to a specific option only.
  • theme hooks (optional): An array containing certain allowed theme hooks, which allow you to limit where the skin can be used. Allowed options include: block, block__MODULE, comment_wrapper,comment__wrapper_NODETYPE, node, node__NODETYPE, region, region__REGIONNAME, panels_display, panels_region, panels_pane, views_view, views_view__STYLENAME, views_view__DISPLAYNAME, and views_view__VIEWNAME.
  • default status (optional): Skins are disabled by default to keep UI clutter to a minimum. In some cases, like contrib themes, it makes sense to enable skins which are required to make the theme work properly by default. Setting this property to 1 will cause it to be enabled by default for all installed themes.
  • status: (optional) An associative array whose keys are theme names and whose corresponding values denote the desired default status for the particular theme.

The "hook" prefix is substituted with the name of the module or theme implementing it.

Related topics

6 functions implement hook_fusion_apply_skin_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

fusion_apply_test_basetheme_fusion_apply_skin_info in fusion_apply/tests/fusion_apply_test/themes/fusion_apply_test_basetheme/fusion_apply_test_basetheme.fusion.inc
Implements hook_fusion_apply_skin_info().
fusion_apply_test_basetheme_other_fusion_apply_skin_info in fusion_apply/tests/fusion_apply_test/themes/fusion_apply_test_basetheme_other/fusion_apply_test_basetheme_other.fusion.inc
Implements hook_fusion_apply_skin_info().
fusion_apply_test_fusion_apply_skin_info in fusion_apply/tests/fusion_apply_test/fusion_apply_test.fusion.inc
Implements hook_fusion_apply_skin_info().
fusion_apply_test_incompatible_fusion_apply_skin_info in fusion_apply/tests/fusion_apply_incompatible/fusion_apply_test_incompatible.module
Implements hook_fusion_apply_skin_info().
fusion_apply_test_subtheme_fusion_apply_skin_info in fusion_apply/tests/fusion_apply_test/themes/fusion_apply_test_subtheme/fusion_apply_test_subtheme.fusion.inc
Implements hook_fusion_apply_skin_info().

... See full list

File

fusion_apply/fusion_apply.api.php, line 208
This file contains no working PHP code; it exists to provide additional documentation for doxygen as well as to document hooks in the standard Drupal manner.

Code

function hook_fusion_apply_skin_info() {
  $skins['fusion_apply_menus'] = array(
    'title' => t('Menu styles'),
    'description' => t('Select a style to use for the main navigation.'),
    'type' => 'select',
    'group' => 'fusion_apply_menus',
    'theme hooks' => array(
      'block__menu',
      'block__menu_block',
    ),
    'attached' => array(
      'css' => array(
        'css/nav.css',
      ),
    ),
    'options' => array(
      'one_level' => array(
        'title' => t('Standard (1 level) - No colors'),
        'class' => array(
          'nav',
        ),
      ),
      'menu_a' => array(
        'title' => t('Standard (1 level) - Green'),
        'class' => array(
          'nav',
          'nav-a',
        ),
        'attached' => array(
          'css' => array(
            'css/nav-colors.css',
          ),
        ),
      ),
      'menu_b' => array(
        'title' => t('Standard (1 level) - Blue'),
        'class' => array(
          'nav',
          'nav-b',
        ),
        'attached' => array(
          'css' => array(
            'css/nav-colors.css',
          ),
        ),
      ),
      'menu_c' => array(
        'title' => t('Dropdowns - No colors'),
        'class' => array(
          'nav',
          'nav-dd',
        ),
        'attached' => array(
          'css' => array(
            'css/nav-dd.css',
          ),
          'js' => array(
            'js/dropdown.js',
          ),
        ),
      ),
      'menu_d' => array(
        'title' => t('Dropdowns - Green'),
        'class' => array(
          'nav',
          'nav-dd',
          'nav-a',
        ),
        'attached' => array(
          'css' => array(
            'css/nav-dd.css',
          ),
          'js' => array(
            'js/dropdown.js',
          ),
        ),
      ),
      'menu_e' => array(
        'title' => t('Dropdowns - Blue'),
        'class' => array(
          'nav',
          'nav-dd',
          'nav-b',
        ),
        'attached' => array(
          'css' => array(
            'css/nav-dd.css',
          ),
          'js' => array(
            'js/dropdown.js',
          ),
        ),
      ),
    ),
    // Optional: Specify a global default status for this skin, making it
    // available or unavailable to all themes.
    'default status' => 0,
    // Optional: Specify a default status for a particular theme. This mainly
    // makes sense for skins provided by themes only.
    'status' => array(
      'bartik' => 1,
      'garland' => 0,
      // In case you are registering a skin for your base theme, then you likely
      // do not know which sub themes are going to use your base theme. By
      // setting the global default status to 0 (as above) and enabling the skin
      // for your base theme itself, the skin's status will be automatically
      // inherited to all sub themes of your base theme.
      'mybasetheme' => 1,
    ),
  );
  return $skins;
}