You are here

elevatezoomplus_ui.module in ElevateZoom Plus 7

Same filename and directory in other branches
  1. 8 modules/ui/elevatezoomplus_ui.module

Provides the ElevateZoomPlus UI.

File

modules/ui/elevatezoomplus_ui.module
View source
<?php

/**
 * @file
 * Provides the ElevateZoomPlus UI.
 */

/**
 * Implements hook_ctools_plugin_directory().
 */
function elevatezoomplus_ui_ctools_plugin_directory($module, $plugin) {
  if ($plugin == 'export_ui') {
    return 'plugins/' . $plugin;
  }
}

/**
 * Implements hook_permission().
 */
function elevatezoomplus_ui_permission() {
  return [
    'administer elevatezoomplus' => [
      'title' => t('Administer the ElevateZoom Plus module'),
    ],
  ];
}

/**
 * Handles AJAX switching the breakpoints based on the input value.
 *
 * This must be put outside the class (always available) for the AJAX to work
 * when using namespaced classes.
 */
function elevatezoomplus_ui_add_repond_validate($form, $form_state) {
  if (!empty($form_state['num_responds']) && $form_state['num_responds'] >= 6) {
    drupal_set_message(t('You are trying to load too many Breakpoints. Try reducing it to reasonable numbers say, between 1 to 5.'));
  }
  return $form['respond']['settings'];
}

/**
 * Handles adding the responds.
 */
function elevatezoomplus_ui_add_respond($form, &$form_state) {
  $form_state['num_responds']++;
  $form_state['rebuild'] = TRUE;
}

/**
 * Callback for adding the responds.
 */
function elevatezoomplus_ui_add_respond_callback($form, $form_state) {
  return $form['respond']['settings'];
}

/**
 * Handles removing the responds.
 */
function _elevatezoomplus_ui_remove_respond($form, &$form_state) {
  $num = $form_state['num_responds'];
  if ($num > 0) {
    $form_state['num_responds'] = $num - 1;
  }
  $form_state['rebuild'] = TRUE;
}

/**
 * Callback for removing the responds.
 */
function _elevatezoomplus_ui_remove_respond_callback($form, $form_state) {
  return $form['respond']['settings'];
}

/**
 * Implements hook_help().
 */
function elevatezoomplus_ui_help($path, $arg) {
  if ($path == 'admin/help#elevatezoomplus_ui') {
    $output = file_get_contents(dirname(dirname(dirname(__FILE__))) . '/README.md');
    return function_exists('_filter_markdown') ? _filter_markdown($output, NULL) : '<pre>' . $output . '</pre>';
  }
  return '';
}

Functions

Namesort descending Description
elevatezoomplus_ui_add_repond_validate Handles AJAX switching the breakpoints based on the input value.
elevatezoomplus_ui_add_respond Handles adding the responds.
elevatezoomplus_ui_add_respond_callback Callback for adding the responds.
elevatezoomplus_ui_ctools_plugin_directory Implements hook_ctools_plugin_directory().
elevatezoomplus_ui_help Implements hook_help().
elevatezoomplus_ui_permission Implements hook_permission().
_elevatezoomplus_ui_remove_respond Handles removing the responds.
_elevatezoomplus_ui_remove_respond_callback Callback for removing the responds.