Skip to content
Snippets Groups Projects
Unverified Commit 3d35d678 authored by totten's avatar totten Committed by GitHub
Browse files

Merge pull request #25490 from colemanw/dynamicCustom

Fix APIv4 autocompletes for dynamic entities
parents a5b51437 d6b82d65
Branches
Tags
No related merge requests found
......@@ -55,6 +55,7 @@ class Request {
if ($daoName && !$daoName::isComponentEnabled()) {
throw new \Civi\API\Exception\NotImplementedException("$entity API is not available because " . $daoName::COMPONENT . " component is disabled");
}
// Extra arguments used e.g. by dynamic entities like Multi-Record custom groups & the ECK extension
$args = (array) CoreUtil::getInfoItem($entity, 'class_args');
$apiRequest = call_user_func_array($callable, $args);
foreach ($params as $name => $param) {
......
......@@ -11,6 +11,7 @@
namespace Civi\Api4\Event\Subscriber;
use Civi\API\Request;
use Civi\Api4\Utils\CoreUtil;
use Civi\Core\Event\GenericHookEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
......@@ -66,7 +67,8 @@ class DefaultDisplaySubscriber extends \Civi\Core\Service\AutoService implements
// Default sort order
$e->display['settings']['sort'] = self::getDefaultSort($entityName);
$fields = CoreUtil::getApiClass($entityName)::get()->entityFields();
$apiGet = Request::create($entityName, 'get', ['version' => 4]);
$fields = $apiGet->entityFields();
$columns = [$labelField];
// Add grouping fields like "event_type_id" in the description
$grouping = (array) (CoreUtil::getCustomGroupExtends($entityName)['grouping'] ?? []);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment