You are here

addtocopy.module in Add link to copied text 6

Same filename and directory in other branches
  1. 8 addtocopy.module
  2. 7 addtocopy.module

File

addtocopy.module
View source
<?php

/**
 * Implements hook_perm().
 */
function addtocopy_perm() {
  return array(
    'bypass addtocopy',
  );
}

/**
 * Implements hook_menu().
 */
function addtocopy_menu() {
  $items = array(
    'admin/settings/addtocopy' => array(
      'title' => 'Add to Copy',
      'description' => 'Configure Add to Copy settings.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'addtocopy_settings_form',
      ),
      'access callback' => 'user_access',
      'access arguments' => array(
        'administer site configuration',
      ),
      'file' => 'addtocopy.admin.inc',
      'type' => MENU_NORMAL_ITEM,
    ),
  );
  return $items;
}

/**
 * Implements hook_init().
 */
function addtocopy_init() {
  if (!user_access('bypass addtocopy')) {
    if (module_exists('libraries')) {
      drupal_add_js(libraries_get_path('addtocopy') . '/addtocopy.js');
    }
    else {
      drupal_add_js('sites/all/libraries/addtocopy' . '/addtocopy.js');
    }
    drupal_add_js(drupal_get_path('module', 'addtocopy') . '/addtocopy.js');
    drupal_add_js(array(
      'addtocopy' => array(
        'selector' => variable_get('addtocopy_selector', '#container, #page'),
        'minlen' => variable_get('addtocopy_minlen', 25),
        'htmlcopytxt' => variable_get('addtocopy_htmlcopytxt', '<br>More: <a href="[link]">[link]</a><br>'),
        'addcopyfirst' => variable_get('addtocopy_addcopyfirst', 0),
      ),
    ), 'setting');
    drupal_add_css(drupal_get_path('module', 'addtocopy') . '/addtocopy.css');
  }
}

Functions

Namesort descending Description
addtocopy_init Implements hook_init().
addtocopy_menu Implements hook_menu().
addtocopy_perm Implements hook_perm().