1
0
mirror of https://github.com/typemill/typemill.git synced 2025-08-05 05:37:45 +02:00

V. 2.8.0 add event onPageUpdated

This commit is contained in:
trendschau
2024-07-30 21:29:24 +02:00
parent 291d092b91
commit aeef379c1f
3 changed files with 30 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ use Typemill\Models\Sitemap;
use Typemill\Static\Slug;
use Typemill\Static\Translations;
use Typemill\Events\OnPagePublished;
use Typemill\Events\OnPageUpdated;
use Typemill\Events\OnPageUnpublished;
use Typemill\Events\OnPageDeleted;
use Typemill\Events\OnPageSorted;
@@ -258,6 +259,8 @@ class ControllerApiAuthorArticle extends Controller
$markdownArray = $content->markdownTextToArray($markdown);
$content->saveDraftMarkdown($item, $markdownArray);
$this->c->get('dispatcher')->dispatch(new OnPageUpdated($markdown), 'onPageUpdated');
$naviFileName = $navigation->getNaviFileNameForPath($item->path);
$navigation->clearNavigation([$naviFileName]);

View File

@@ -10,6 +10,7 @@ use Typemill\Models\Validation;
use Typemill\Models\Content;
use Typemill\Models\Meta;
use Typemill\Static\Translations;
use Typemill\Events\OnPageUpdated;
class ControllerApiAuthorBlock extends Controller
{
@@ -96,6 +97,9 @@ class ControllerApiAuthorBlock extends Controller
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
}
$markdown = $content->markdownArrayToText($draftMarkdown);
$this->c->get('dispatcher')->dispatch(new OnPageUpdated($markdown), 'onPageUpdated');
$draftMarkdownHtml = $content->addDraftHtml($draftMarkdown);
# if it was published before, then we need to refresh the navigation
@@ -197,6 +201,9 @@ class ControllerApiAuthorBlock extends Controller
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
}
$markdown = $content->markdownArrayToText($draftMarkdown);
$this->c->get('dispatcher')->dispatch(new OnPageUpdated($markdown), 'onPageUpdated');
$draftMarkdownHtml = $content->addDraftHtml($draftMarkdown);
# if it was published before, then we need to refresh the navigation
@@ -311,6 +318,9 @@ class ControllerApiAuthorBlock extends Controller
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
}
$markdown = $content->markdownArrayToText($draftMarkdown);
$this->c->get('dispatcher')->dispatch(new OnPageUpdated($markdown), 'onPageUpdated');
$draftMarkdownHtml = $content->addDraftHtml($draftMarkdown);
# if it was published before, then we need to refresh the navigation
@@ -416,6 +426,9 @@ class ControllerApiAuthorBlock extends Controller
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
}
$markdown = $content->markdownArrayToText($draftMarkdown);
$this->c->get('dispatcher')->dispatch(new OnPageUpdated($markdown), 'onPageUpdated');
$draftMarkdownHtml = $content->addDraftHtml($draftMarkdown);
# if it was published before, then we need to refresh the navigation

View File

@@ -0,0 +1,14 @@
<?php
namespace Typemill\Events;
use Symfony\Component\EventDispatcher\Event;
/**
* Event for breadcrumb.
*/
class OnPageUpdated extends BaseEvent
{
}