You are here

private function SalesforceMappingFieldsForm::getRow in Salesforce Suite 8.3

Helper function to return an empty row for the field mapping form.

1 call to SalesforceMappingFieldsForm::getRow()
SalesforceMappingFieldsForm::buildForm in modules/salesforce_mapping/src/Form/SalesforceMappingFieldsForm.php
Form constructor.

File

modules/salesforce_mapping/src/Form/SalesforceMappingFieldsForm.php, line 196

Class

SalesforceMappingFieldsForm
Salesforce Mapping Fields Form.

Namespace

Drupal\salesforce_mapping\Form

Code

private function getRow(FieldPluginInterface $field_plugin = NULL, $form, FormStateInterface $form_state) {
  $input = $form_state
    ->getUserInput();
  if ($field_plugin == NULL) {
    $field_type = $input['field_type'];
    $field_plugin_definition = $this
      ->getFieldPlugin($field_type);
    $field_plugin = $this->mappingFieldPluginManager
      ->createInstance($field_plugin_definition['id']);
  }
  $row['config'] = $field_plugin
    ->buildConfigurationForm($form, $form_state);

  // @TODO implement "lock/unlock" logic here:
  // @TODO convert these to AJAX operations
  $operations = [
    'delete' => $this
      ->t('Delete'),
  ];
  $defaults = [];
  $row['ops'] = [
    '#title' => t('Operations'),
    '#type' => 'checkboxes',
    '#options' => $operations,
    '#default_value' => $defaults,
  ];
  $row['drupal_field_type'] = [
    '#type' => 'hidden',
    '#value' => $field_plugin
      ->getPluginId(),
  ];
  return $row;
}