You are here

anchor_link.module in CKEditor Anchor Link - For Drupal 8 and 9 8

Same filename and directory in other branches
  1. 8.2 anchor_link.module
  2. 3.0.x anchor_link.module

Contains anchor_link.module.

File

anchor_link.module
View source
<?php

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

/**
 * Implements hook_help().
 */
function anchor_link_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {

    // Main module help for the entity_link module.
    case 'help.page.anchor_link':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('This plugin module adds the better link dialog and anchor related features to CKEditor in Drupal 8') . '</p>';
      $output .= '<p><ul>';
      $output .= '  <li>Dialog to insert links and anchors with some properties.</li>';
      $output .= '  <li>Context menu option to edit or remove links and anchors.</li>';
      $output .= '  <li>Ability to insert a link with the URL using multiple protocols, including an external file if a file manager is integrated.</li>';
      $output .= '</ul></p>';
      $output .= '<p><a href="http://ckeditor.com/addon/link">http://ckeditor.com/addon/link</a></p>';
      return $output;
    default:
  }
}

/**
 * Implements hook_theme().
 */
function anchor_link_theme() {
  $theme = [];
  return $theme;
}

/**
 * Implements hook_page_attachments().
 */
function anchor_link_page_attachments(array &$attachments) {
  if (\Drupal::currentUser()
    ->isAuthenticated()) {
    $attachments['#attached']['library'][] = 'anchor_link/drupal.anchor_link';
  }
}

Functions