Filtere im Aufbau-Picker nach der Filterregel, nenne betroffene Objekte und tausche beim Sortieren nur Nachbarn
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e20f428a57
commit
8a97d9c334
5 files changed
+81
-7
No files matched your search
@@ -298,10 +298,14 @@ private function kontextKonflikte(EditorialContentKind $kind, array $neu): array
|
||||
{
|
||||
$verwendung = $this->verwendung($kind);
|
||||
$meldungen = [];
|
||||
$zeilen = null;
|
||||
|
||||
foreach ((array) ($kind->contexts ?? []) as $context) {
|
||||
if (! in_array($context, $neu, true) && ($verwendung[$context] ?? 0) > 0) {
|
||||
$meldungen[] = (EditorialContentKind::CONTEXTS[$context] ?? $context).': '.$verwendung[$context].' '.($verwendung[$context] === 1 ? 'Zuordnung' : 'Zuordnungen').'.';
|
||||
$zeilen ??= $this->verwendungListe($kind)['zeilen'];
|
||||
$titel = array_slice(array_column(array_filter($zeilen, fn (array $z): bool => $z['art'] === (EditorialContentKind::CONTEXTS[$context] ?? '')), 'titel'), 0, 5);
|
||||
$meldungen[] = (EditorialContentKind::CONTEXTS[$context] ?? $context).': '.$verwendung[$context].' '.($verwendung[$context] === 1 ? 'Zuordnung' : 'Zuordnungen')
|
||||
.($titel !== [] ? ' („'.implode('“, „', $titel).'“'.($verwendung[$context] > count($titel) ? ' und weitere' : '').')' : '').'.';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -482,6 +486,21 @@ private function verschiebe(Model $record, int $richtung): void
|
||||
return;
|
||||
}
|
||||
|
||||
$nachbar = $liste->get($index + $richtung);
|
||||
|
||||
// Nur die beiden Einträge tauschen; neu nummeriert wird nur bei gleicher Reihenfolgezahl.
|
||||
if ((int) $record->sort_order !== (int) $nachbar->sort_order) {
|
||||
DB::transaction(function () use ($record, $nachbar): void {
|
||||
[$a, $b] = [(int) $record->sort_order, (int) $nachbar->sort_order];
|
||||
$record->sort_order = $b;
|
||||
$record->save();
|
||||
$nachbar->sort_order = $a;
|
||||
$nachbar->save();
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$neu = $liste->all();
|
||||
[$neu[$index], $neu[$index + $richtung]] = [$neu[$index + $richtung], $neu[$index]];
|
||||
|
||||
|
||||
@@ -238,4 +238,15 @@ private function filterByMaterialart(array $result): array
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Einordnungsfilter des Pickers: dieselbe Filterregel wie Medien- und Kompositionslisten (verwendete inaktive Werte
|
||||
* bleiben auffindbar, ein gewählter Filter bleibt sichtbar).
|
||||
*
|
||||
* @return list<array{label: string, values: list<array{id: int, label: string}>}>
|
||||
*/
|
||||
public function pickerDimensionGroups(): array
|
||||
{
|
||||
return app(EditorialVocabulary::class)->dimensionFilterGroups(ctype_digit($this->pickerDimension) ? [(int) $this->pickerDimension] : []);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user