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

This commit is contained in:
Justin Goette 2023-01-29 14:13:29 -05:00 committed by GitHub
parent 57e79e7f1b
commit 69290c8e55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 9 deletions

View File

@ -39,19 +39,24 @@ class FilterBridge extends FeedExpander
'type' => 'checkbox', 'type' => 'checkbox',
'required' => false, 'required' => false,
], ],
'target_title' => [ 'target_author' => [
'name' => 'Apply filter on title', 'name' => 'Apply filter on author',
'type' => 'checkbox', 'type' => 'checkbox',
'required' => false, 'required' => false,
'defaultValue' => 'checked'
], ],
'target_content' => [ 'target_content' => [
'name' => 'Apply filter on content', 'name' => 'Apply filter on content',
'type' => 'checkbox', 'type' => 'checkbox',
'required' => false, 'required' => false,
], ],
'target_author' => [ 'target_title' => [
'name' => 'Apply filter on author', 'name' => 'Apply filter on title',
'type' => 'checkbox',
'required' => false,
'defaultValue' => 'checked'
],
'target_uri' => [
'name' => 'Apply filter on URI/URL',
'type' => 'checkbox', 'type' => 'checkbox',
'required' => false, 'required' => false,
], ],
@ -90,14 +95,17 @@ class FilterBridge extends FeedExpander
// Retrieve fields to check // Retrieve fields to check
$filter_fields = []; $filter_fields = [];
if ($this->getInput('target_title')) { if ($this->getInput('target_author')) {
$filter_fields[] = $item['title'] ?? null; $filter_fields[] = $item['author'] ?? null;
} }
if ($this->getInput('target_content')) { if ($this->getInput('target_content')) {
$filter_fields[] = $item['content'] ?? null; $filter_fields[] = $item['content'] ?? null;
} }
if ($this->getInput('target_author')) { if ($this->getInput('target_title')) {
$filter_fields[] = $item['author'] ?? null; $filter_fields[] = $item['title'] ?? null;
}
if ($this->getInput('target_uri')) {
$filter_fields[] = $item['uri'] ?? null;
} }
// Apply filter on item // Apply filter on item