You are here

function accordions_preprocess_block in Accordions 7

Implements hook_preprocess_block().

1 string reference to 'accordions_preprocess_block'
accordions_accordions_types in ./accordions.accordions.inc
Implements hook_accordions_types().

File

./accordions.module, line 439

Code

function accordions_preprocess_block(&$vars) {
  $record = accordions_item_load('block', $vars['block']->module, $vars['block']->delta, array(
    'name',
    'initial',
  ));
  if ($record) {

    // The .accordion class is used to identify items needing processing as
    // accordions in javascript, and for easier theming of all accordions.
    $vars['classes_array'][] = 'accordion';

    // The data-accordions-type attribute is used to identify how the accordion
    // item needs processing (e.g. what selector to use to find the label).
    $vars['attributes_array']['data-accordions-type'] = 'block';

    // The data-accordions-group attribute is used for grouping items into
    // distinct accordions.
    $vars['attributes_array']['data-accordions-group'] = $record['name'];

    // The data-accordions-initial attribute is used to determine that the
    // accordion item should initially be expanded.
    if ($record['initial']) {
      $vars['attributes_array']['data-accordions-initial'] = TRUE;
    }
    accordions_js('block');
  }
}