1 | <?php |
||
27 | class ReorderSubscriber implements EventSubscriberInterface |
||
28 | { |
||
29 | /** |
||
30 | * @var NodeManager |
||
31 | */ |
||
32 | private $nodeManager; |
||
33 | |||
34 | /** |
||
35 | * @var DocumentRegistry |
||
36 | */ |
||
37 | private $documentRegistry; |
||
38 | |||
39 | /** |
||
40 | * @param NodeManager $nodeManager |
||
41 | * @param DocumentRegistry $documentRegistry |
||
42 | */ |
||
43 | public function __construct(NodeManager $nodeManager, DocumentRegistry $documentRegistry) |
||
48 | |||
49 | /** |
||
50 | * {@inheritdoc} |
||
51 | */ |
||
52 | public static function getSubscribedEvents() |
||
58 | |||
59 | /** |
||
60 | * Handle the reorder operation. |
||
61 | * |
||
62 | * @param ReorderEvent $event |
||
63 | * |
||
64 | * @throws DocumentManagerException |
||
65 | */ |
||
66 | public function handleReorder(ReorderEvent $event) |
||
83 | |||
84 | private function resolveSiblingName($siblingId, NodeInterface $parentNode, NodeInterface $node) |
||
108 | |||
109 | /** |
||
110 | * If the node should be ordered after the target then we need to order the |
||
111 | * node before the sibling after the target sibling. If the node should be the |
||
112 | * last sibling, then the target sibling should be NULL. |
||
113 | * |
||
114 | * @param NodeInterface $parentNode |
||
115 | * @param string $siblingName |
||
116 | * |
||
117 | * @return string |
||
118 | */ |
||
119 | private function resolveAfterSiblingName(NodeInterface $parentNode, $siblingName) |
||
136 | } |
||
137 |