Use helper for checking items to get by name
authorColeman Watts <coleman@civicrm.org>
Thu, 24 Oct 2019 12:15:27 +0000 (08:15 -0400)
committerCiviCRM <info@civicrm.org>
Wed, 16 Sep 2020 02:13:19 +0000 (19:13 -0700)
ext/afform/core/Civi/Api4/Action/Afform/Get.php

index 867cdc0d78ee6ddf801402c94edbbaf88ac8e322..61da5f8d523a0f921dc31d50e355d56fa54bba31 100644 (file)
@@ -17,13 +17,7 @@ class Get extends BasicGetAction {
     /** @var \CRM_Afform_AfformScanner $scanner */
     $scanner = \Civi::service('afform_scanner');
 
-    $where = $this->getWhere();
-    if (count($where) === 1 && $where[0][0] === 'name' && $where[0][1] == '=') {
-      $names = [$where[0][2]];
-    }
-    else {
-      $names = array_keys($scanner->findFilePaths());
-    }
+    $names = $this->_itemsToGet('name') ?? array_keys($scanner->findFilePaths());
 
     $values = [];
     foreach ($names as $name) {