Pick images, pages, forms, sections and terms instead of typing ids and addresses
The share image and featured image of a page become image fields with the library dialog, as do image settings of plugins. The editor offers forms, sections, categories and tags as lists, a page search next to every link target and in text links, the redirect target has a page search, and the form editor picks the reply field, the condition and the option images. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
31fb53c1fc
commit
711af312af
19 files changed
+446
-43
No files matched your search
@@ -139,9 +139,26 @@ final class EditorController extends AbstractController
|
||||
'buttonOptions' => \App\Content\ButtonDesign::OPTIONS,
|
||||
'buttonPresets' => \App\Content\ButtonDesign::PRESETS,
|
||||
'csrfToken' => $this->csrf->getToken('editor')->getValue(),
|
||||
// Was ein Baustein per Adresse verknuepft, waehlt man aus einer Liste - niemand soll
|
||||
// die Adresse eines Formulars oder einer Kategorie auswendig wissen muessen.
|
||||
'choices' => $this->choices(),
|
||||
]);
|
||||
}
|
||||
|
||||
/** @return array<string, array<string, string>> Adresse => Name, je Art */
|
||||
private function choices(): array
|
||||
{
|
||||
$choices = ['forms' => [], 'sections' => $this->partials->choices('section'), 'categories' => [], 'tags' => []];
|
||||
foreach ($this->forms->all() as $form) {
|
||||
$choices['forms'][$form['slug']] = $form['name'];
|
||||
}
|
||||
foreach ($this->posts->allTerms() as $term) {
|
||||
$choices['category' === $term['kind'] ? 'categories' : 'tags'][$term['slug']] = $term['name'];
|
||||
}
|
||||
|
||||
return $choices;
|
||||
}
|
||||
|
||||
/** Saves or removes a reusable style, so a look can be applied to other blocks and pages. */
|
||||
#[Route('/api/style-presets', name: 'admin_style_preset', methods: ['POST'])]
|
||||
public function stylePreset(Request $request): JsonResponse
|
||||
|
||||
@@ -33,9 +33,19 @@ final class PluginExtension extends AbstractExtension
|
||||
new TwigFunction('kant_plugin_props', $this->props(...)),
|
||||
new TwigFunction('kant_plugin_media', $this->mediaItem(...)),
|
||||
new TwigFunction('kant_plugin_settings', $this->plugins->settingsOf(...)),
|
||||
new TwigFunction('kant_media', $this->adminMedia(...)),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Ein Bild fuer ein Bildfeld der Verwaltung - auch ein archiviertes: es ist noch gewaehlt und
|
||||
* wird noch ausgeliefert, also soll es auch zu sehen sein.
|
||||
*/
|
||||
public function adminMedia(string $id): ?array
|
||||
{
|
||||
return 1 === preg_match('/^[a-f0-9]{32}$/D', $id) ? $this->media->find($id) : null;
|
||||
}
|
||||
|
||||
/** Die geprüften Eigenschaften eines Bausteins - oder null, wenn sie nicht ins Schema passen. */
|
||||
public function props(array $block): ?array
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user