Constant.php in Salesforce Suite 8.4
File
modules/salesforce_mapping/src/Plugin/SalesforceMappingField/Constant.php
View source
<?php
namespace Drupal\salesforce_mapping\Plugin\SalesforceMappingField;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\salesforce_mapping\SalesforceMappingFieldPluginBase;
use Drupal\salesforce_mapping\Entity\SalesforceMappingInterface;
use Drupal\salesforce_mapping\MappingConstants;
class Constant extends SalesforceMappingFieldPluginBase {
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$pluginForm = parent::buildConfigurationForm($form, $form_state);
$pluginForm['drupal_field_value'] += [
'#type' => 'textfield',
'#default_value' => $this
->config('drupal_field_value'),
'#description' => $this
->t('Enter a constant value to map to a Salesforce field.'),
];
$pluginForm['direction']['#options'] = [
MappingConstants::SALESFORCE_MAPPING_DIRECTION_DRUPAL_SF => $pluginForm['direction']['#options'][MappingConstants::SALESFORCE_MAPPING_DIRECTION_DRUPAL_SF],
];
$pluginForm['direction']['#default_value'] = MappingConstants::SALESFORCE_MAPPING_DIRECTION_DRUPAL_SF;
return $pluginForm;
}
public function value(EntityInterface $entity, SalesforceMappingInterface $mapping) {
return $this
->config('drupal_field_value');
}
public function pull() {
return FALSE;
}
}
Classes
Name |
Description |
Constant |
Adapter for entity Constant and fields. |