You are here

protected function Properties::getConfigurationOptions in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 8.3 modules/salesforce_mapping/src/Plugin/SalesforceMappingField/Properties.php \Drupal\salesforce_mapping\Plugin\SalesforceMappingField\Properties::getConfigurationOptions()
  2. 5.0.x modules/salesforce_mapping/src/Plugin/SalesforceMappingField/Properties.php \Drupal\salesforce_mapping\Plugin\SalesforceMappingField\Properties::getConfigurationOptions()

Form options helper.

1 call to Properties::getConfigurationOptions()
Properties::buildConfigurationForm in modules/salesforce_mapping/src/Plugin/SalesforceMappingField/Properties.php
Implementation of PluginFormInterface::buildConfigurationForm.

File

modules/salesforce_mapping/src/Plugin/SalesforceMappingField/Properties.php, line 51

Class

Properties
Adapter for entity properties and fields.

Namespace

Drupal\salesforce_mapping\Plugin\SalesforceMappingField

Code

protected function getConfigurationOptions(SalesforceMappingInterface $mapping) {

  /** @var \Drupal\Core\Field\FieldDefinitionInterface[] $field_definitions */
  $field_definitions = $this->entityFieldManager
    ->getFieldDefinitions($mapping
    ->get('drupal_entity_type'), $mapping
    ->get('drupal_bundle'));
  $options = [];
  foreach ($field_definitions as $field_name => $field_definition) {
    $label = $field_definition
      ->getLabel();
    if ($this
      ->instanceOfEntityReference($field_definition)) {
      continue;
    }
    else {

      // Get a list of property definitions.
      $property_definitions = $field_definition
        ->getFieldStorageDefinition()
        ->getPropertyDefinitions();
      if (count($property_definitions) > 1) {
        foreach ($property_definitions as $property => $property_definition) {
          $options[(string) $label][$field_name . '.' . $property] = $label . ': ' . $property_definition
            ->getLabel();
        }
      }
      else {
        $options[$field_name] = $label;
      }
    }
  }
  asort($options);
  return $options;
}