You are here

function parallax_block_block_view_alter in Parallax Toolkit 7.3

Same name and namespace in other branches
  1. 7.2 parallax_block/parallax_block.module \parallax_block_block_view_alter()

Implements hook_block_view_alter().

File

parallax_block/parallax_block.module, line 40
Enable Parallax effect for any block created by the user.

Code

function parallax_block_block_view_alter(&$data, $block) {
  if ($block->vertical_parallax_value != 'none' || $block->horizontal_parallax_value != 'none') {
    drupal_add_js(drupal_get_path('module', 'parallax_block') . '/parallax.js');
    drupal_add_css(drupal_get_path('module', 'parallax_block') . '/parallax.css');
    $image_url = file_create_url(file_load($block->background_image)->uri);
    $image = "<img class='parallax-image' alt='Parallax Image' src='{$image_url}'>";
    $data['parallax'] = $image;

    // dsm($block);
  }
}