Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add visibility filter #17

Draft
wants to merge 4 commits into
base: master-ibx3
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,3 @@ bin/releaser tag

[auto-install]: https://img.shields.io/badge/CI-install-green?style=flat-square&labelColor=black&logo=github-actions
[auto-test]: https://img.shields.io/badge/CI-tests-green?style=flat-square&labelColor=black&logo=github-actions

















18 changes: 18 additions & 0 deletions components/RssFeedBundle/src/bundle/Entity/RssFeedItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ class RssFeedItems
*/
private $subtreePath;

/**
* @var bool
*
* @ORM\Column(name="only_visible", type="boolean")
*/
private $onlyVisible;

/**
* @var string
*
Expand Down Expand Up @@ -149,6 +156,7 @@ public function toArray(): array
return [
'locationId' => $this->getSubtreePath(),
'includeSubtreePath' => $this->getIncludeSubtree(),
'onlyVisible' => $this->getOnlyVisible(),
'contentTypeId' => $this->getContentTypeId(),
'fieldTypesIdentifier' => [
'title' => $this->getTitle(),
Expand Down Expand Up @@ -242,4 +250,14 @@ public function setMedia($media = null): self

return $this;
}

public function getOnlyVisible(): bool
{
return $this->onlyVisible;
}

public function setOnlyVisible(bool $onlyVisible): void
{
$this->onlyVisible = $onlyVisible;
}
}
8 changes: 8 additions & 0 deletions components/RssFeedBundle/src/bundle/Form/RssFeedItemsType.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'required' => false,
]
)
->add(
'only_visible',
CheckboxType::class,
[
'label' => 'ez_rss_feed.form.only_visible',
'required' => false,
]
)
->add(
'contenttype_id',
ChoiceType::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@
</div>
</div>
{% endblock _rss_feeds_feed_items_entry_include_subtree_row %}
{% block _rss_feeds_feed_items_entry_only_visible_row %}
<div class="form-group col-md-12 col-sm-12 col-xs-12 pull-left">
<label class="form-label">
{{- form_label(form) -}}
</label>
<div class="controls">
{{- form_errors(form) -}}
{{- form_widget(form) -}}
</div>
</div>
{% endblock _rss_feeds_feed_items_entry_only_visible_row %}
{% block _rss_feeds_feed_items_entry_contenttype_id_row %}
<div class="form-group col-md-12 col-sm-12 col-xs-12 pull-left">
<label class="form-label">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ public function fetchContent(RssFeeds $rssFeed): array
);
}

if ($filter['onlyVisible']) {
$criterion[] = new Query\Criterion\Visibility(Query\Criterion\Visibility::VISIBLE);
}

$criterion[] = new Query\Criterion\ContentTypeId($filter['contentTypeId']);

$queryFilter[] = new Query\Criterion\LogicalAnd($criterion);
Expand Down