You are here

function Utils::wf_crm_apivalues in Webform CiviCRM Integration 8.5

Get the values from an api call

Parameters

string $entity: API entity

string $operation: API operation

array $params: API params

string $value: Reduce each result to this single value

Return value

array Values from API call

Overrides UtilsInterface::wf_crm_apivalues

12 calls to Utils::wf_crm_apivalues()
Utils::wf_crm_format_event in src/Utils.php
Utils::wf_crm_get_campaign_activity_types in src/Utils.php
Get activity types related to CiviCampaign
Utils::wf_crm_get_civi_setting in src/Utils.php
Utils::wf_crm_get_contact_types in src/Utils.php
Get contact types and sub-types Unlike pretty much every other option list CiviCRM wants "name" instead of "id"
Utils::wf_crm_get_events in src/Utils.php
Get list of events.

... See full list

File

src/Utils.php, line 776
Webform CiviCRM module's common utility functions.

Class

Utils

Namespace

Drupal\webform_civicrm

Code

function wf_crm_apivalues($entity, $operation, $params = [], $value = NULL) {
  if (is_numeric($params)) {
    $params = [
      'id' => $params,
    ];
  }
  $params += [
    'options' => [],
  ];

  // Work around the api's default limit of 25
  $params['options'] += [
    'limit' => 0,
  ];
  $ret = wf_crm_aval($this
    ->wf_civicrm_api($entity, $operation, $params), 'values', []);
  if ($value) {
    foreach ($ret as &$values) {
      $values = wf_crm_aval($values, $value);
    }
  }
  return $ret;
}