From f8d34bf2ed2c650fcdec9b9fc7ccf4d31dee6fdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20LIMOUZIN?= Date: Wed, 14 Oct 2020 12:00:43 +0200 Subject: [PATCH] Add visibility filter --- src/bundle/Entity/RssFeedItems.php | 24 +++++++++++++++++++ src/bundle/Form/RssFeedItemsType.php | 8 +++++++ .../Resources/translations/messages.en.yml | 1 + .../Resources/translations/messages.fr.yml | 1 + .../views/Form/form_fields.html.twig | 11 +++++++++ src/bundle/Services/RssFeedsService.php | 4 ++++ 6 files changed, 49 insertions(+) diff --git a/src/bundle/Entity/RssFeedItems.php b/src/bundle/Entity/RssFeedItems.php index 36169e9..e43ec60 100644 --- a/src/bundle/Entity/RssFeedItems.php +++ b/src/bundle/Entity/RssFeedItems.php @@ -88,6 +88,13 @@ class RssFeedItems */ private $category; + /** + * @var bool + * + * @ORM\Column(name="only_visible", type="boolean") + */ + private $onlyVisible; + /** * @var string * @@ -168,6 +175,7 @@ public function toArray() 'locationId' => $this->getSubtreePath(), 'includeSubtreePath' => $this->getIncludeSubtree(), 'contentTypeId' => $this->getContentTypeId(), + 'onlyVisible' => $this->getOnlyVisible(), 'fieldTypesIdentifier' => [ 'title' => $this->getTitle(), 'description' => $this->getDescription(), @@ -344,4 +352,20 @@ public function setMedia($media = null) return $this; } + + /** + * @return bool + */ + public function getOnlyVisible(): bool + { + return $this->onlyVisible; + } + + /** + * @param bool $onlyVisible + */ + public function setOnlyVisible(bool $onlyVisible): void + { + $this->onlyVisible = $onlyVisible; + } } diff --git a/src/bundle/Form/RssFeedItemsType.php b/src/bundle/Form/RssFeedItemsType.php index 05509db..7d1a9ad 100644 --- a/src/bundle/Form/RssFeedItemsType.php +++ b/src/bundle/Form/RssFeedItemsType.php @@ -82,6 +82,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'required' => false, ] ) + ->add( + 'only_visible', + CheckboxType::class, + [ + 'label' => 'ez_rss_feed.form.only_visible', + 'required' => false, + ] + ) ->add( 'contenttype_id', ChoiceType::class, diff --git a/src/bundle/Resources/translations/messages.en.yml b/src/bundle/Resources/translations/messages.en.yml index c170527..711d63e 100644 --- a/src/bundle/Resources/translations/messages.en.yml +++ b/src/bundle/Resources/translations/messages.en.yml @@ -19,6 +19,7 @@ ez_rss_feed.form.url_slug: URL ez_rss_feed.form.sources: Sources ez_rss_feed.form.subtree_path: Select location path ez_rss_feed.form.include_subtree: Include sub node +ez_rss_feed.form.only_visible: Only visible node ez_rss_feed.form.number_of_object: Number of objects ez_rss_feed.form.contenttype: Select content type ez_rss_feed.form.field.title: Title field diff --git a/src/bundle/Resources/translations/messages.fr.yml b/src/bundle/Resources/translations/messages.fr.yml index c220d6c..62061bd 100644 --- a/src/bundle/Resources/translations/messages.fr.yml +++ b/src/bundle/Resources/translations/messages.fr.yml @@ -19,6 +19,7 @@ ez_rss_feed.form.url_slug: URL ez_rss_feed.form.sources: Sources ez_rss_feed.form.subtree_path: Sélectionner un emplacement ez_rss_feed.form.include_subtree: Inclure les sous noeuds +ez_rss_feed.form.only_visible: Afficher uniquement les noeuds visibles ez_rss_feed.form.number_of_object: Nombre d'objet ez_rss_feed.form.contenttype: Sélectionner le type de contenu ez_rss_feed.form.field.title: Champ Titre diff --git a/src/bundle/Resources/views/Form/form_fields.html.twig b/src/bundle/Resources/views/Form/form_fields.html.twig index 0075e01..13bae0f 100644 --- a/src/bundle/Resources/views/Form/form_fields.html.twig +++ b/src/bundle/Resources/views/Form/form_fields.html.twig @@ -43,6 +43,17 @@ {% endblock _rss_feeds_feed_items_entry_include_subtree_row %} +{% block _rss_feeds_feed_items_entry_only_visible_row %} +
+ +
+ {{- form_errors(form) -}} + {{- form_widget(form) -}} +
+
+{% endblock _rss_feeds_feed_items_entry_only_visible_row %} {% block _rss_feeds_feed_items_entry_contenttype_id_row %}