diff --git a/src/Controller/ReadingListWizardController.php b/src/Controller/ReadingListWizardController.php index 82b5850..29c84cf 100644 --- a/src/Controller/ReadingListWizardController.php +++ b/src/Controller/ReadingListWizardController.php @@ -141,6 +141,7 @@ class ReadingListWizardController extends AbstractController $tags[] = ['type', 'reading-list']; if ($draft->title) { $tags[] = ['title', $draft->title]; } if ($draft->summary) { $tags[] = ['summary', $draft->summary]; } + if ($draft->image) { $tags[] = ['image', $draft->image]; } foreach ($draft->tags as $t) { $tags[] = ['t', $t]; } foreach ($draft->articles as $a) { if (is_string($a) && $a !== '') { $tags[] = ['a', $a]; } diff --git a/src/Dto/CategoryDraft.php b/src/Dto/CategoryDraft.php index 225c93b..0f54779 100644 --- a/src/Dto/CategoryDraft.php +++ b/src/Dto/CategoryDraft.php @@ -8,6 +8,7 @@ class CategoryDraft { public string $title = ''; public string $summary = ''; + public string $image = ''; /** @var string[] */ public array $tags = []; /** @var string[] article coordinates like kind:pubkey:slug */ diff --git a/src/Form/CategoryType.php b/src/Form/CategoryType.php index f8d8719..2f0cd69 100644 --- a/src/Form/CategoryType.php +++ b/src/Form/CategoryType.php @@ -7,6 +7,7 @@ namespace App\Form; use App\Dto\CategoryDraft; use App\Form\DataTransformer\CommaSeparatedToArrayTransformer; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -29,6 +30,11 @@ class CategoryType extends AbstractType 'required' => false, 'empty_data' => '', ]) + ->add('image', TextType::class, [ + 'label' => 'Cover image URL', + 'required' => false, + 'empty_data' => '', + ]) ->add('tags', TextType::class, [ 'label' => 'Tags (comma separated)', 'required' => false, diff --git a/src/Service/ReadingListManager.php b/src/Service/ReadingListManager.php index c0f2057..c482a6e 100644 --- a/src/Service/ReadingListManager.php +++ b/src/Service/ReadingListManager.php @@ -190,6 +190,7 @@ class ReadingListManager match ($tagName) { 'title' => $draft->title = (string)$tagValue, 'summary' => $draft->summary = (string)$tagValue, + 'image' => $draft->image = (string)$tagValue, 't' => $draft->tags[] = (string)$tagValue, 'a' => $draft->articles[] = (string)$tagValue, default => null, diff --git a/templates/reading_list/reading_setup.html.twig b/templates/reading_list/reading_setup.html.twig index 35f81cd..fc32092 100644 --- a/templates/reading_list/reading_setup.html.twig +++ b/templates/reading_list/reading_setup.html.twig @@ -6,6 +6,44 @@ {{ form_start(form) }} {{ form_row(form.title, {label: 'Title'}) }} {{ form_row(form.summary) }} + {{ form_row(form.image) }} + +