|
4 | 4 |
|
5 | 5 | use Drupal\Core\Entity\FieldableEntityInterface; |
6 | 6 | use Drupal\Core\Form\FormStateInterface; |
7 | | -use Drupal\Core\Url; |
8 | 7 | use Drupal\Core\Utility\Error; |
9 | | -use Drupal\next\Entity\NextSite; |
10 | 8 | use Drupal\next\Event\EntityActionEvent; |
11 | 9 | use Drupal\next\Plugin\ConfigurableRevalidatorBase; |
12 | 10 | use Drupal\next\Plugin\RevalidatorInterface; |
@@ -72,7 +70,7 @@ public function revalidate(EntityActionEvent $event): bool { |
72 | 70 | foreach ($sites as $site) { |
73 | 71 | try { |
74 | 72 | $tags_string = implode(',', $tags); |
75 | | - $revalidate_url = $this->getRevalidateUrlForTags($site, $tags_string); |
| 73 | + $revalidate_url = $site->buildRevalidateUrl(['tags' => $tags_string]); |
76 | 74 |
|
77 | 75 | if (!$revalidate_url) { |
78 | 76 | throw new \Exception('No revalidate url set.'); |
@@ -110,30 +108,4 @@ public function revalidate(EntityActionEvent $event): bool { |
110 | 108 | return $revalidated; |
111 | 109 | } |
112 | 110 |
|
113 | | - /** |
114 | | - * Returns the revalidate url for given cache tags. |
115 | | - * |
116 | | - * @param NextSite $site |
117 | | - * @param string $cache_tags |
118 | | - * The cache tags as string. |
119 | | - * |
120 | | - * @return \Drupal\Core\Url|null |
121 | | - * The revalidate url. |
122 | | - */ |
123 | | - protected function getRevalidateUrlForTags(NextSite $site, string $cache_tags): ?Url { |
124 | | - $revalidate_url = $site->getRevalidateUrl(); |
125 | | - if (!$revalidate_url) { |
126 | | - return NULL; |
127 | | - } |
128 | | - $query = [ |
129 | | - 'tags' => $cache_tags, |
130 | | - ]; |
131 | | - if ($secret = $site->getRevalidateSecret()) { |
132 | | - $query['secret'] = $secret; |
133 | | - } |
134 | | - return Url::fromUri($site->getRevalidateUrl(), [ |
135 | | - 'query' => $query, |
136 | | - ]); |
137 | | - } |
138 | | - |
139 | 111 | } |
0 commit comments