You are here

clipboardjs.module in Clipboard.js 8

Same filename and directory in other branches
  1. 7 clipboardjs.module
  2. 2.0.x clipboardjs.module

Contains clipboardjs.module.

File

clipboardjs.module
View source
<?php

/**
 * @file
 * Contains clipboardjs.module.
 */
use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_help().
 */
function clipboardjs_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.clipboardjs':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('Clipboard.js') . '</p>';
      return $output;
    default:
  }
}

/**
 * Implements hook_theme().
 */
function clipboardjs_theme($existing, $type, $theme, $path) {
  return [
    'clipboardjs' => [
      'variables' => [
        'text' => NULL,
        'alert_style' => 'tooltip',
        'alert_text' => t('Copy was successful!'),
        'height' => 13,
        'width' => 13,
      ],
    ],
  ];
}

/**
 * Implements hook_preprocess_HOOK().
 */
function clipboardjs_preprocess_clipboardjs(&$variables) {
  $variables['module_path'] = base_path() . drupal_get_path('module', 'clipboardjs');
  $variables['id'] = uniqid('clipboardjs-');
}