-
Notifications
You must be signed in to change notification settings - Fork 2
/
ckeditor_mentions.module
executable file
·49 lines (43 loc) · 1.51 KB
/
ckeditor_mentions.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?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:
}
}