You are here

protected function SalesforceMappingFieldPluginBase::getSalesforceFieldOptions in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 8.3 modules/salesforce_mapping/src/SalesforceMappingFieldPluginBase.php \Drupal\salesforce_mapping\SalesforceMappingFieldPluginBase::getSalesforceFieldOptions()
  2. 5.0.x modules/salesforce_mapping/src/SalesforceMappingFieldPluginBase.php \Drupal\salesforce_mapping\SalesforceMappingFieldPluginBase::getSalesforceFieldOptions()

Helper to retreive a list of fields for a given object type.

Parameters

string $sfobject_name: The object type of whose fields you want to retreive.

Return value

array An array of values keyed by machine name of the field with the label as the value, formatted to be appropriate as a value for #options.

1 call to SalesforceMappingFieldPluginBase::getSalesforceFieldOptions()
SalesforceMappingFieldPluginBase::buildConfigurationForm in modules/salesforce_mapping/src/SalesforceMappingFieldPluginBase.php
Form constructor.

File

modules/salesforce_mapping/src/SalesforceMappingFieldPluginBase.php, line 521

Class

SalesforceMappingFieldPluginBase
Defines a base Salesforce Mapping Field Plugin implementation.

Namespace

Drupal\salesforce_mapping

Code

protected function getSalesforceFieldOptions($sfobject_name) {

  // Static cache since this function is called frequently across many
  // different object instances.
  $options =& drupal_static(__CLASS__ . __FUNCTION__, []);
  if (empty($options[$sfobject_name])) {
    $describe = $this->salesforceClient
      ->objectDescribe($sfobject_name);
    $options[$sfobject_name] = $describe
      ->getFieldOptions();
  }
  return $options[$sfobject_name];
}