You are here

webform_accordion.module in Webform Accordion 7.2

Same filename and directory in other branches
  1. 6 webform_accordion.module
  2. 7 webform_accordion.module

Main module file for the webform_accordion module.

File

webform_accordion.module
View source
<?php

/**
 * @file
 * Main module file for the webform_accordion module.
 */

/**
 * Implements hook_webform_component_info().
 *
 * Defines the Accordion Group and Accordion Tab components.
 *
 * @see hook_webform_component_info().
 */
function webform_accordion_webform_component_info() {
  $components = array();
  $components['accordion_grp'] = array(
    'label' => t('Accordion Container'),
    'description' => t('A container for grouping the tabs of an accordion.'),
    'features' => array(
      'csv' => FALSE,
      'default_value' => FALSE,
      'required' => FALSE,
      'conditional' => FALSE,
      'group' => TRUE,
      'title_inline' => FALSE,
      'email' => FALSE,
      'email_address' => FALSE,
      'email_name' => FALSE,
      'spam_analysis' => FALSE,
    ),
    'file' => 'components/accordion_container.inc',
  );
  $components['accordion_tab'] = array(
    'label' => t('Accordion Tab'),
    'description' => t('A single tab in the accordion.  Must be placed inside of an Accordion Container.'),
    'features' => array(
      'csv' => FALSE,
      'default_value' => FALSE,
      'required' => FALSE,
      'conditional' => FALSE,
      'group' => TRUE,
      'title_inline' => FALSE,
      'email' => FALSE,
      'email_address' => FALSE,
      'email_name' => FALSE,
      'spam_analysis' => FALSE,
    ),
    'file' => 'components/accordion_tab.inc',
  );
  return $components;
}

/**
 * Implements hook_theme().
 */
function webform_accordion_theme() {
  return array(
    'webform_accordion_tab' => array(
      'render element' => 'element',
    ),
    'webform_accordion_tab_template' => array(
      'variables' => array(
        'id' => NULL,
        'title' => NULL,
        'children' => NULL,
        'element' => NULL,
      ),
      'path' => drupal_get_path('module', 'webform_accordion') . '/templates',
      'template' => 'webform-accordion-tab',
    ),
  );
}

/**
 * Helper function for embedding the module js and css files.
 */
function webform_accordion_insert_js_css() {
  static $embedded = FALSE;
  if (!$embedded) {
    drupal_add_library('system', 'ui');
    drupal_add_library('system', 'ui.widget');
    drupal_add_library('system', 'ui.accordion');
    drupal_add_js(drupal_get_path('module', 'webform_accordion') . '/js/webform_accordion.js');
    $embedded = TRUE;
  }
}

Functions

Namesort descending Description
webform_accordion_insert_js_css Helper function for embedding the module js and css files.
webform_accordion_theme Implements hook_theme().
webform_accordion_webform_component_info Implements hook_webform_component_info().