Skip to content

Commit

Permalink
Allow filtering when return options are set
Browse files Browse the repository at this point in the history
  • Loading branch information
tschuettler committed Aug 3, 2017
1 parent 34239e8 commit 525ccb6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion api/v3/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,10 @@ function civicrm_api3_extension_get($params) {
}
}
$options = _civicrm_api3_get_options_from_params($params);
$returnFields = !empty($options['return']) ? $options['return'] : array('id');
$returnFields = !empty($options['return']) ? $options['return'] : array();
if (!in_array('id', $returnFields)) {
$returnFields = array_merge($returnFields, array('id'));
}
return _civicrm_api3_basic_array_get('Extension', $params, $result, 'id', $returnFields);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/api/v3/ExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function testGetMultipleExtensionsApiExplorer() {
* Test that extension get can be filtered by id.
*/
public function testGetExtensionByID() {
$result = $this->callAPISuccess('extension', 'get', array('id' => 2));
$result = $this->callAPISuccess('extension', 'get', array('id' => 2, 'return' => array('label')));
$this->assertEquals(1, $result['count']);
}

Expand Down

0 comments on commit 525ccb6

Please sign in to comment.