ckeditor_mentions-8.x-2.x-dev/ckeditor_mentions.module

ckeditor_mentions.module
<?php

/**
 * @file
 * Custom code implementations for Ckeditor mentions.
 */

use Drupal\ckeditor_mentions\Events\CKEditorEvents;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Url;

/**
 * Implements hook_entity_update().
 */
function ckeditor_mentions_entity_update(EntityInterface $entity) {
  $mentions = \Drupal::getContainer()->get('ckeditor_mentions.mention_event_dispatcher');
  $mentions->dispatchMentionEvent($entity, CKEditorEvents::MENTION_SUBSEQUENT);
}

/**
 * Implements hook_entity_insert().
 */
function ckeditor_mentions_entity_insert(EntityInterface $entity) {
  $mentions = \Drupal::getContainer()->get('ckeditor_mentions.mention_event_dispatcher');
  $mentions->dispatchMentionEvent($entity, CKEditorEvents::MENTION_FIRST);
}

/**
 * Implements hook_help().
 */
function ckeditor_mentions_help($route_name) {
  switch ($route_name) {
    case 'help.page.ckeditor_mentions':
      $output = '';
      $output .= '<h3>' . t('Ckeditor Mentions') . '</h3>';
      $output .= '<p>' . t('The module adds a mentions support to the CKEditor.') . '</p>';
      $output .= '<h3>' . t('Uses') . '</h3>';
      $output .= '<dl>';
      $output .= '<dt>' . t('Settings') . '</dt>';
      $output .= '<dd>' . t(
          'In the <a href=":text-formats">text formats</a> that use ckeditor, configure each text format that you want to add mentions support.',
          [':text-formats' => Url::fromRoute('filter.admin_overview')->toString()]
        ) . '</dd>';
      $output .= '</dl>';
      return $output;

    default:
  }
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc