Skip to content

Commit f63c043

Browse files
author
roadiz-ci
committed
feat(nodes-sources): add scheduled unpublishedAt expiration field (#463)
1 parent 8e980b6 commit f63c043

4 files changed

Lines changed: 37 additions & 0 deletions

File tree

src/Form/NodeSource/NodeSourceBaseType.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,21 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
4848
],
4949
]);
5050
}
51+
52+
if (true === $options['unpublishable']) {
53+
$builder->add('unpublishedAt', DateTimeType::class, [
54+
'label' => 'unpublishedAt',
55+
'required' => false,
56+
'attr' => [
57+
'data-dev-name' => '{{ nodeSource.'.StringHandler::camelCase('unpublishedAt').' }}',
58+
],
59+
'html5' => true,
60+
'placeholder' => [
61+
'hour' => 'hour',
62+
'minute' => 'minute',
63+
],
64+
]);
65+
}
5166
}
5267

5368
#[\Override]
@@ -63,6 +78,7 @@ public function configureOptions(OptionsResolver $resolver): void
6378
'label' => false,
6479
'inherit_data' => true,
6580
'publishable' => false,
81+
'unpublishable' => false,
6682
'attr' => [
6783
'no-field-group' => true,
6884
],

src/Form/NodeSource/NodeSourceType.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
6262
if (true === $options['withTitle']) {
6363
$builder->add('base', NodeSourceBaseType::class, [
6464
'publishable' => $options['nodeType']->isPublishable(),
65+
'unpublishable' => $options['nodeType']->isUnpublishable(),
6566
'translation' => $builder->getData()->getTranslation(),
6667
]);
6768
}

translations/rozier/messages.en.xlf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4403,6 +4403,16 @@
44034403
<target state="final">Date and time publishable</target>
44044404
<note>Field label for node-type publishable status.</note>
44054405
</trans-unit>
4406+
<trans-unit xml:space="preserve" id="unpublishedAt" approved="yes">
4407+
<source>unpublishedAt</source>
4408+
<target state="final">Unpublication date and time</target>
4409+
<note>Field label for node-source scheduled expiration date and time.</note>
4410+
</trans-unit>
4411+
<trans-unit xml:space="preserve" id="unpublishable" approved="yes">
4412+
<source>unpublishable</source>
4413+
<target state="final">Date and time unpublishable</target>
4414+
<note>Field label for node-type unpublishable status.</note>
4415+
</trans-unit>
44064416
<!-- Node form help messages -->
44074417
<trans-unit xml:space="preserve" id="this_node_type_will_be_available_for_creating_root_nodes" approved="yes">
44084418
<source>this_node_type_will_be_available_for_creating_root_nodes</source>

translations/rozier/messages.fr.xlf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4403,6 +4403,16 @@
44034403
<target state="final">Publiable par date et heure</target>
44044404
<note>Field label for node-type publishable status.</note>
44054405
</trans-unit>
4406+
<trans-unit xml:space="preserve" id="unpublishedAt" approved="yes">
4407+
<source>unpublishedAt</source>
4408+
<target state="final">Date et heure de dépublication</target>
4409+
<note>Field label for node-source scheduled expiration date and time.</note>
4410+
</trans-unit>
4411+
<trans-unit xml:space="preserve" id="unpublishable" approved="yes">
4412+
<source>unpublishable</source>
4413+
<target state="final">Dépubliable par date et heure</target>
4414+
<note>Field label for node-type unpublishable status.</note>
4415+
</trans-unit>
44064416
<!-- Node form help messages -->
44074417
<trans-unit xml:space="preserve" id="this_node_type_will_be_available_for_creating_root_nodes" approved="yes">
44084418
<source>this_node_type_will_be_available_for_creating_root_nodes</source>

0 commit comments

Comments
 (0)