You are here

protected function SalesforceMappingFormBase::getSalesforceObjectTypeOptions in Salesforce Suite 8.3

Helper to retreive a list of object type options.

Return value

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

1 call to SalesforceMappingFormBase::getSalesforceObjectTypeOptions()
SalesforceMappingFormCrudBase::buildForm in modules/salesforce_mapping/src/Form/SalesforceMappingFormCrudBase.php
Form constructor.

File

modules/salesforce_mapping/src/Form/SalesforceMappingFormBase.php, line 140

Class

SalesforceMappingFormBase
Salesforce Mapping Form base.

Namespace

Drupal\salesforce_mapping\Form

Code

protected function getSalesforceObjectTypeOptions() {
  $sfobject_options = [];

  // Note that we're filtering SF object types to a reasonable subset.
  $config = $this
    ->config('salesforce.settings');
  $filter = $config
    ->get('show_all_objects') ? [] : [
    'updateable' => TRUE,
    'triggerable' => TRUE,
  ];
  $sfobjects = $this->client
    ->objects($filter);
  foreach ($sfobjects as $object) {
    $sfobject_options[$object['name']] = $object['label'] . ' (' . $object['name'] . ')';
  }
  asort($sfobject_options);
  return $sfobject_options;
}