Skip to content
Snippets Groups Projects
Commit 08febd9a authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2823955 by Jo Fitzgerald, benjy, quietone, claudiu.cristea, mikeryan:...

Issue #2823955 by Jo Fitzgerald, benjy, quietone, claudiu.cristea, mikeryan: No need to specify operator for Vocabulary filter in Term source
parent 71479932
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -54,7 +54,7 @@ public function query() {
->orderBy('td.tid');
if (isset($this->configuration['vocabulary'])) {
$query->condition('td.vid', $this->configuration['vocabulary'], 'IN');
$query->condition('td.vid', (array) $this->configuration['vocabulary'], 'IN');
}
return $query;
......
......@@ -27,7 +27,7 @@ public function query() {
->orderBy('td.tid');
if (isset($this->configuration['bundle'])) {
$query->condition('td.vid', $this->configuration['bundle'], 'IN');
$query->condition('td.vid', (array) $this->configuration['bundle'], 'IN');
}
return $query;
......
......@@ -67,6 +67,13 @@ public function providerSource() {
'description' => 'description value 6',
'weight' => 0,
],
[
'tid' => 7,
'vid' => 3,
'name' => 'name value 7',
'description' => 'description value 7',
'weight' => 0,
],
];
$tests[0]['source_data']['term_hierarchy'] = [
[
......@@ -97,6 +104,10 @@ public function providerSource() {
'tid' => 6,
'parent' => 2,
],
[
'tid' => 7,
'parent' => 0,
],
];
// The expected results.
......@@ -149,8 +160,58 @@ public function providerSource() {
'weight' => 0,
'parent' => [3, 2],
],
[
'tid' => 7,
'vid' => 3,
'name' => 'name value 7',
'description' => 'description value 7',
'weight' => 0,
'parent' => [0],
],
];
$tests[0]['expected_count'] = NULL;
// Empty configuration will return terms for all vocabularies.
$tests[0]['configuration'] = [];
// Change configuration to get one vocabulary, 5.
$tests[1]['source_data'] = $tests[0]['source_data'];
$tests[1]['expected_data'] = [
[
'tid' => 1,
'vid' => 5,
'name' => 'name value 1',
'description' => 'description value 1',
'weight' => 0,
'parent' => [0],
],
[
'tid' => 4,
'vid' => 5,
'name' => 'name value 4',
'description' => 'description value 4',
'weight' => 1,
'parent' => [1],
],
];
$tests[1]['expected_count'] = NULL;
$tests[1]['configuration']['bundle'] = ['5'];
// Same as previous test, but with configuration vocabulary as a string
// instead of an array.
$tests[2]['source_data'] = $tests[0]['source_data'];
$tests[2]['expected_data'] = $tests[1]['expected_data'];
$tests[2]['expected_count'] = NULL;
$tests[2]['configuration']['bundle'] = '5';
// Change configuration to get two vocabularies, 5 and 6.
$tests[3]['source_data'] = $tests[0]['source_data'];
$tests[3]['expected_data'] = $tests[0]['expected_data'];
// Remove the last element because it is for vid 3.
array_pop($tests[3]['expected_data']);
$tests[3]['expected_count'] = NULL;
$tests[3]['configuration']['bundle'] = ['5', '6'];
return $tests;
}
......
......@@ -67,6 +67,13 @@ public function providerSource() {
'description' => 'description value 6',
'weight' => 0,
],
[
'tid' => 7,
'vid' => 3,
'name' => 'name value 7',
'description' => 'description value 7',
'weight' => 0,
],
];
$tests[0]['source_data']['taxonomy_term_hierarchy'] = [
[
......@@ -97,6 +104,10 @@ public function providerSource() {
'tid' => 6,
'parent' => 2,
],
[
'tid' => 7,
'parent' => 0,
],
];
$tests[0]['source_data']['taxonomy_vocabulary'] = [
[
......@@ -189,8 +200,58 @@ public function providerSource() {
'weight' => 0,
'parent' => [3, 2],
],
[
'tid' => 7,
'vid' => 3,
'name' => 'name value 7',
'description' => 'description value 7',
'weight' => 0,
'parent' => [0],
],
];
$tests[0]['expected_count'] = NULL;
// Empty configuration will return terms for all vocabularies.
$tests[0]['configuration'] = [];
// Change configuration to get one vocabulary, "tags".
$tests[1]['source_data'] = $tests[0]['source_data'];
$tests[1]['expected_data'] = [
[
'tid' => 1,
'vid' => 5,
'name' => 'name value 1',
'description' => 'description value 1',
'weight' => 0,
'parent' => [0],
],
[
'tid' => 4,
'vid' => 5,
'name' => 'name value 4',
'description' => 'description value 4',
'weight' => 1,
'parent' => [1],
],
];
$tests[1]['expected_count'] = NULL;
$tests[1]['configuration']['bundle'] = ['tags'];
// Same as previous test, but with configuration vocabulary as a string
// instead of an array.
$tests[2]['source_data'] = $tests[0]['source_data'];
$tests[2]['expected_data'] = $tests[1]['expected_data'];
$tests[2]['expected_count'] = NULL;
$tests[2]['configuration']['bundle'] = 'tags';
// Change configuration to get two vocabularies, "tags" and "categories".
$tests[3]['source_data'] = $tests[0]['source_data'];
$tests[3]['expected_data'] = $tests[0]['expected_data'];
// Remove the last element because it is for vid 3.
array_pop($tests[3]['expected_data']);
$tests[3]['expected_count'] = NULL;
$tests[3]['configuration']['bundle'] = ['tags', 'categories'];
return $tests;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment