Halte ungenutzte Medien bearbeitbar und lege Dateien direkt im Modul an.
Deploy Test / test (push) Successful in 26s
Deploy Test / deploy (push) Successful in 30s

Eine Fassung wird erst unveränderlich, wenn sie freigegeben und verwendet wird. Das Auge am Listeneintrag öffnet die Vorschau.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-11-17 10:34:42 +01:00
1 parent 1fb48783bf
commit c73207f2c3
11 files changed
+547 -25

No files matched your search

+14 -6
View File
@@ -40,7 +40,7 @@ public function rows(CompositionVersion $version, int $exceptCompositionId): arr
$target = $member->content_element_version_id
? 'element:'.$member->content_element_version_id
: 'composition:'.$member->nested_composition_version_id;
$row = $this->rowForTarget($target, $exceptCompositionId, allowSelf: true);
$row = $this->rowForTarget($target, $exceptCompositionId, allowSelf: true, allowDraft: true);
if ($row === null) {
continue;
@@ -57,7 +57,7 @@ public function rows(CompositionVersion $version, int $exceptCompositionId): arr
/**
* @return array<string, string|null>|null
*/
public function rowForTarget(string $target, int $exceptCompositionId, bool $allowSelf = false): ?array
public function rowForTarget(string $target, int $exceptCompositionId, bool $allowSelf = false, bool $allowDraft = false): ?array
{
if (preg_match('/^(element|composition):(\d+)$/', $target, $match) !== 1) {
return null;
@@ -67,8 +67,13 @@ public function rowForTarget(string $target, int $exceptCompositionId, bool $all
$version = ContentElementVersion::query()
->with('element.editorialContentKind')
->find($match[2]);
$acceptable = [ContentVersionStatus::Bereit];
if (! $version instanceof ContentElementVersion || $version->status !== ContentVersionStatus::Bereit) {
if ($allowDraft) {
$acceptable[] = ContentVersionStatus::Entwurf;
}
if (! $version instanceof ContentElementVersion || ! in_array($version->status, $acceptable, true)) {
return null;
}
@@ -80,13 +85,16 @@ public function rowForTarget(string $target, int $exceptCompositionId, bool $all
'target' => 'element:'.$version->id,
'title' => $title,
'kind' => $kind,
'output' => (string) $element->output_class,
'body' => (string) ($version->body ?? ''),
'summary' => (string) ($element->summary ?: $element->description ?: ''),
'medium_description' => (string) ($element->description ?? ''),
'usage_note' => (string) ($element->usage_note ?? ''),
'license_note' => (string) ($element->license_note ?? ''),
'tone' => $this->tone((string) $element->output_class, $kind),
'image' => $this->cardUrl('element', $element->id, $element->thumbnail_path),
'version_label' => 'Fassung '.$version->number,
'version_label' => $version->status === ContentVersionStatus::Entwurf ? 'Entwurf' : 'Fassung '.$version->number,
'committed' => app(ContentService::class)->isCommitted($version),
'identity' => 'medium:'.$element->id,
'open_url' => route('content.preview', $version),
'open_label' => 'Medium ansehen',
@@ -119,8 +127,8 @@ public function rowForTarget(string $target, int $exceptCompositionId, bool $all
'image' => $this->cardUrl('komposition', $composition->id, $composition->thumbnail_path),
'version_label' => 'Fassung '.$version->number,
'identity' => 'zusammenstellung:'.$composition->id,
'open_url' => null,
'open_label' => null,
'open_url' => route('editorial.preview', ['composition' => $composition, 'version' => $version]),
'open_label' => 'Aufbau ansehen',
'edit_url' => self::editUrl($composition),
];
}