feat(core,ecommerce,ckeditor5): 이미지 업로드 필터 훅 대칭화
공개 제보(리뷰 이미지에 filter_upload_file 부재)를 계기로 전 이미지 업로드 경로의 훅 트라이어드를 대칭화한다. 확장이 업로드 파일을 저장 전에 가로채 압축/변환할 수 있도록 하기 위함. - 리뷰 이미지·CKEditor5 이미지 업로드에 filter_upload_file 필터 훅 추가 - 레이아웃 편집기 첨부 업로드에 훅 트라이어드(before/filter/after) 신설 - ckeditor5 1.0.2 버전 동기(manifest/package/composer/lock), 각 CHANGELOG 기재, README 기여자 등재, hooks.md 업로드 트라이어드 및 필터 반환 계약 문서화 - 시나리오 매니페스트(upload-filter-hook-parity) + 3계층 훅 발화 테스트 추가
This commit is contained in:
1 parent
709fbff278
commit
b1b5bfa417
18 files changed
+1279
-6
No files matched your search
@@ -5,6 +5,7 @@ namespace App\Services;
|
||||
use App\Contracts\Extension\StorageInterface;
|
||||
use App\Contracts\Repositories\TemplateLayoutAttachmentRepositoryInterface;
|
||||
use App\Contracts\Repositories\TemplateRepositoryInterface;
|
||||
use App\Extension\HookManager;
|
||||
use App\Models\TemplateLayoutAttachment;
|
||||
use App\Support\ImageResizer;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
@@ -52,6 +53,12 @@ class TemplateLayoutAttachmentService
|
||||
return ['success' => false, 'attachment' => null, 'url' => null, 'error' => 'template_not_found'];
|
||||
}
|
||||
|
||||
// 훅: 업로드 전 (확장 지점)
|
||||
HookManager::doAction('core.template_layout_attachment.before_upload', $file, $templateIdentifier, $layoutName);
|
||||
|
||||
// 필터 훅 - 파일 데이터 변형 (압축, 리사이즈 등 확장 포인트)
|
||||
$file = HookManager::applyFilters('core.template_layout_attachment.filter_upload_file', $file);
|
||||
|
||||
// 저장 경로 — 템플릿 식별자/날짜별 디렉토리 + UUID 파일명 (충돌 회피)
|
||||
$storedFilename = Str::uuid().'.'.$file->getClientOriginalExtension();
|
||||
$relativePath = "{$templateIdentifier}/".date('Y/m/d')."/{$storedFilename}";
|
||||
@@ -87,6 +94,8 @@ class TemplateLayoutAttachmentService
|
||||
'path' => $relativePath,
|
||||
]);
|
||||
|
||||
HookManager::doAction('core.template_layout_attachment.after_upload', $attachment);
|
||||
|
||||
return [
|
||||
'success' => true,
|
||||
'attachment' => $attachment,
|
||||
|
||||
Reference in new issue
Block a user