aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/front/controller/admin/ManageShaareController.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/front/controller/admin/ManageShaareController.php')
-rw-r--r--application/front/controller/admin/ManageShaareController.php25
1 files changed, 5 insertions, 20 deletions
diff --git a/application/front/controller/admin/ManageShaareController.php b/application/front/controller/admin/ManageShaareController.php
index 3aa48423..33e1188e 100644
--- a/application/front/controller/admin/ManageShaareController.php
+++ b/application/front/controller/admin/ManageShaareController.php
@@ -152,7 +152,7 @@ class ManageShaareController extends ShaarliAdminController
152 // To preserve backward compatibility with 3rd parties, plugins still use arrays 152 // To preserve backward compatibility with 3rd parties, plugins still use arrays
153 $formatter = $this->container->formatterFactory->getFormatter('raw'); 153 $formatter = $this->container->formatterFactory->getFormatter('raw');
154 $data = $formatter->format($bookmark); 154 $data = $formatter->format($bookmark);
155 $data = $this->executeHooks('save_link', $data); 155 $this->executePageHooks('save_link', $data);
156 156
157 $bookmark->fromArray($data); 157 $bookmark->fromArray($data);
158 $this->container->bookmarkService->set($bookmark); 158 $this->container->bookmarkService->set($bookmark);
@@ -211,7 +211,7 @@ class ManageShaareController extends ShaarliAdminController
211 } 211 }
212 212
213 $data = $formatter->format($bookmark); 213 $data = $formatter->format($bookmark);
214 $this->container->pluginManager->executeHooks('delete_link', $data); 214 $this->executePageHooks('delete_link', $data);
215 $this->container->bookmarkService->remove($bookmark, false); 215 $this->container->bookmarkService->remove($bookmark, false);
216 ++ $count; 216 ++ $count;
217 } 217 }
@@ -283,7 +283,7 @@ class ManageShaareController extends ShaarliAdminController
283 283
284 // To preserve backward compatibility with 3rd parties, plugins still use arrays 284 // To preserve backward compatibility with 3rd parties, plugins still use arrays
285 $data = $formatter->format($bookmark); 285 $data = $formatter->format($bookmark);
286 $this->container->pluginManager->executeHooks('save_link', $data); 286 $this->executePageHooks('save_link', $data);
287 $bookmark->fromArray($data); 287 $bookmark->fromArray($data);
288 288
289 $this->container->bookmarkService->set($bookmark, false); 289 $this->container->bookmarkService->set($bookmark, false);
@@ -325,7 +325,7 @@ class ManageShaareController extends ShaarliAdminController
325 325
326 // To preserve backward compatibility with 3rd parties, plugins still use arrays 326 // To preserve backward compatibility with 3rd parties, plugins still use arrays
327 $data = $formatter->format($bookmark); 327 $data = $formatter->format($bookmark);
328 $this->container->pluginManager->executeHooks('save_link', $data); 328 $this->executePageHooks('save_link', $data);
329 $bookmark->fromArray($data); 329 $bookmark->fromArray($data);
330 330
331 $this->container->bookmarkService->set($bookmark); 331 $this->container->bookmarkService->set($bookmark);
@@ -354,7 +354,7 @@ class ManageShaareController extends ShaarliAdminController
354 'default_private_links' => $this->container->conf->get('privacy.default_private_links', false), 354 'default_private_links' => $this->container->conf->get('privacy.default_private_links', false),
355 ]; 355 ];
356 356
357 $data = $this->executeHooks('render_editlink', $data); 357 $this->executePageHooks('render_editlink', $data, TemplatePage::EDIT_LINK);
358 358
359 foreach ($data as $key => $value) { 359 foreach ($data as $key => $value) {
360 $this->assignView($key, $value); 360 $this->assignView($key, $value);
@@ -368,19 +368,4 @@ class ManageShaareController extends ShaarliAdminController
368 368
369 return $response->write($this->render(TemplatePage::EDIT_LINK)); 369 return $response->write($this->render(TemplatePage::EDIT_LINK));
370 } 370 }
371
372 /**
373 * @param mixed[] $data Variables passed to the template engine
374 *
375 * @return mixed[] Template data after active plugins render_picwall hook execution.
376 */
377 protected function executeHooks(string $hook, array $data): array
378 {
379 $this->container->pluginManager->executeHooks(
380 $hook,
381 $data
382 );
383
384 return $data;
385 }
386} 371}