You are here

function _blockanimate_add_js_classes_and_attributes in BlockAnimate 7

Extend block's classes and attributes.

Extend block's classes with animate css classes and block's attributes with wow.js attributes. It adds the required Javascript file to create and initialize the WOW Javascript object.

2 calls to _blockanimate_add_js_classes_and_attributes()
blockanimate_preprocess_block in ./blockanimate.module
Implements theme_preprocess_block().
blockanimate_preprocess_panels_pane in ./blockanimate.module
Implements hook_preprocess_HOOK().

File

./blockanimate.module, line 73
Add CSS3 cross-browser animation to any Drupal block.

Code

function _blockanimate_add_js_classes_and_attributes($block, &$vars) {
  if (isset($block->animate_css_class) && $block->animate_css_class != 'none' && $block->animate_css_class != '') {

    // If an animation exists, we create and activate the WOW Javascript object.
    $js_path = drupal_get_path('module', 'blockanimate') . '/js/blockanimate.js';
    drupal_add_js($js_path);

    // Add the wow attributes to the block attributes if needed.
    $animate_attributes = _blockanimate_get_block_attributes($block);
    $vars['attributes_array'] = array_merge($vars['attributes_array'], $animate_attributes);

    // And add the Animate CSS classes to the block classes if needed.
    $animate_classes = _blockanimate_get_block_classes($block);
    $vars['classes_array'] = array_merge($vars['classes_array'], $animate_classes);
  }
}