diff --git a/src/Form/ItemType.php b/src/Form/ItemType.php index b9501b5..2073deb 100644 --- a/src/Form/ItemType.php +++ b/src/Form/ItemType.php @@ -123,6 +123,8 @@ public function buildForm(FormBuilderInterface $builder, array $options) : void 'choice_attr' => fn (Period $period, $key, $value) => ['data-year' => $period->getSortableYear()], 'expanded' => false, 'multiple' => false, + 'required' => false, + 'placeholder' => 'Unknown', ]); $builder->add('periodEnd', EntityType::class, [ 'label' => 'Latest creation', @@ -131,6 +133,8 @@ public function buildForm(FormBuilderInterface $builder, array $options) : void 'choice_attr' => fn (Period $period, $key, $value) => ['data-year' => $period->getSortableYear()], 'expanded' => false, 'multiple' => false, + 'required' => false, + 'placeholder' => 'Unknown', ]); $builder->add('provenance', Select2EntityType::class, [ diff --git a/templates/item/show.html.twig b/templates/item/show.html.twig index 581c5b0..6a63272 100644 --- a/templates/item/show.html.twig +++ b/templates/item/show.html.twig @@ -128,11 +128,11 @@ {{ dl.make(item, 'dimensions', 'Dimensions') }} {{ dl.make(item, 'location', 'Location') }} {{ dl.make(item, 'civilization', 'Culture', 'civilization_show') }} - {% set display_period = [item.periodStart] %} + {% set display_period = [item.periodStart|default('Unknown')] %} {% if not(item.periodEnd is same as(item.periodStart)) %} - {% set display_period = display_period|merge([item.periodEnd]) %} + {% set display_period = display_period|merge([item.periodEnd|default('Unknown')]) %} {% endif %} - {{ dl.make({'display': display_period|join('-')|lower}, 'display', "Period") }} + {{ dl.make({'display': display_period|join(' - ')|lower}, 'display', "Period") }} {{ dl.make(item, 'subjects', "Subjects", "subject_show") }} {% endset %}