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

feat: [FilterBridge] Add URI/URL filter option to FilterBridge #3212

Merged
merged 1 commit into from
Jan 29, 2023
Merged
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
26 changes: 17 additions & 9 deletions bridges/FilterBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,24 @@ class FilterBridge extends FeedExpander
'type' => 'checkbox',
'required' => false,
],
'target_title' => [
'name' => 'Apply filter on title',
'target_author' => [
'name' => 'Apply filter on author',
'type' => 'checkbox',
'required' => false,
'defaultValue' => 'checked'
],
'target_content' => [
'name' => 'Apply filter on content',
'type' => 'checkbox',
'required' => false,
],
'target_author' => [
'name' => 'Apply filter on author',
'target_title' => [
'name' => 'Apply filter on title',
'type' => 'checkbox',
'required' => false,
'defaultValue' => 'checked'
],
'target_uri' => [
'name' => 'Apply filter on URI/URL',
'type' => 'checkbox',
'required' => false,
],
Expand Down Expand Up @@ -90,14 +95,17 @@ protected function parseItem($newItem)

// Retrieve fields to check
$filter_fields = [];
if ($this->getInput('target_title')) {
$filter_fields[] = $item['title'] ?? null;
if ($this->getInput('target_author')) {
$filter_fields[] = $item['author'] ?? null;
}
if ($this->getInput('target_content')) {
$filter_fields[] = $item['content'] ?? null;
}
if ($this->getInput('target_author')) {
$filter_fields[] = $item['author'] ?? null;
if ($this->getInput('target_title')) {
$filter_fields[] = $item['title'] ?? null;
}
if ($this->getInput('target_uri')) {
$filter_fields[] = $item['uri'] ?? null;
}

// Apply filter on item
Expand Down