-
Notifications
You must be signed in to change notification settings - Fork 1
/
wmpathauto.module
62 lines (52 loc) · 1.8 KB
/
wmpathauto.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
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
use Drupal\Core\Entity\EntityInterface;
use Drupal\pathauto\PathautoPatternInterface;
use Drupal\wmpathauto\Event\AliasAlterEvent;
use Drupal\wmpathauto\Event\PatternAlterEvent;
function wmpathauto_pathauto_pattern_alter(PathautoPatternInterface $pattern, array $context)
{
\Drupal::getContainer()->get('event_dispatcher')->dispatch(
new PatternAlterEvent($pattern, $context),
PatternAlterEvent::NAME
);
}
function wmpathauto_pathauto_alias_alter(string &$alias, array $context)
{
\Drupal::getContainer()->get('event_dispatcher')->dispatch(
new AliasAlterEvent($alias, $context),
AliasAlterEvent::NAME
);
}
function wmpathauto_entity_update(EntityInterface $entity)
{
\Drupal::getContainer()
->get('wmpathauto.menu_link_content.subscriber')
->onMenuLinkUpdate($entity);
\Drupal::getContainer()
->get('wmpathauto.entity_alias_dependency.update.subscriber')
->onEntityUpdate($entity);
}
function wmpathauto_entity_insert(EntityInterface $entity)
{
\Drupal::getContainer()
->get('wmpathauto.menu_link_content.subscriber')
->onMenuLinkUpdate($entity);
\Drupal::getContainer()
->get('wmpathauto.entity_alias_dependency.update.subscriber')
->onEntityUpdate($entity);
}
function wmpathauto_entity_translation_insert(EntityInterface $translation)
{
\Drupal::getContainer()
->get('wmpathauto.menu_link_content.subscriber')
->onMenuLinkUpdate($translation);
\Drupal::getContainer()
->get('wmpathauto.entity_alias_dependency.update.subscriber')
->onEntityUpdate($translation);
}
function wmpathauto_entity_delete(EntityInterface $entity)
{
\Drupal::getContainer()
->get('wmpathauto.entity_alias_dependency.delete.subscriber')
->onEntityDelete($entity);
}