You are here

npop.api.php in Node pop-up 7

Hooks provided by Node popup nodule.

File

npop.api.php
View source
<?php

/**
 * @file
 * Hooks provided by Node popup nodule.
 */

/**
 * @addtogroup hooks
 * @{
 */

/**
 * Alter popup content render array, before rendering.
 *
 * This function is called for each popup window creation.
 *
 * @param array $view
 *   An render array of popup content.
 * @param object $node
 *   The popup node object.
 */
function hook_npop_view_data_alter(array &$view, $node) {

  // Change close icon text to FontAwesome close icon.
  $view['node']['closebtn']['#text'] = '<i class="fa fa-close"></i>';
}

/**
 * Alert ajax commands before popup window open.
 *
 * Use this alter, if you want change ajax commands or execute your command on
 * popup window open event.
 *
 * @param array $commands
 *   An array with commands generated by module.
 * @param object $node
 *   The popup node object.
 */
function hook_npop_ajax_alter(array &$commands, $node) {

  // Alert window openned when popup open event called.
  $commands[] = ajax_command_alert('Window openned');
}

/**
 * Alert ajax commands when popup window close.
 *
 * Use this alter, if you want change ajax commands or execute your command on
 * popup window close event.
 *
 * @param array $commands
 *   An array with commands generated by module.
 */
function hook_npop_ajax_close_alter(array &$commands) {

  // Alert window closed when popup close event called.
  $commands[] = ajax_command_alert('Window openned');
}

/**
 * You can define your animations.
 *
 * First step: add your css file with animations to site.
 *
 * Second step: define bellow hook and return array of css classes.
 *
 * Array is keyd my class name and values is titles, for administration page.
 */
function hook_npop_css_animations() {
  drupal_add_css(drupal_get_path('module', 'mymodule') . '/css/myanimations.css');
  return array(
    'npop-animate-fade-left' => t('From left with fade side'),
    'npop-animate-fade-right' => t('From right with fade side'),
    'npop-animate-fade-top' => t('From top with fade side'),
    'npop-animate-fade-bottom' => t('From bottom with fade side'),
    'npop-animate-left' => t('From left side'),
    'npop-animate-right' => t('From right side'),
    'npop-animate-top' => t('From top side'),
    'npop-animate-bottom' => t('From bottom side'),
  );
}

/*
 * @} End of "addtogroup hooks".
 */

Functions

Namesort descending Description
hook_npop_ajax_alter Alert ajax commands before popup window open.
hook_npop_ajax_close_alter Alert ajax commands when popup window close.
hook_npop_css_animations You can define your animations.
hook_npop_view_data_alter Alter popup content render array, before rendering.