commerce_funds-8.x-1.7/src/Plugin/Field/FieldWidget/FundsTransactionEscrowWidget.php
src/Plugin/Field/FieldWidget/FundsTransactionEscrowWidget.php
<?php
namespace Drupal\commerce_funds\Plugin\Field\FieldWidget;
use Drupal\Core\Field\Attribute\FieldWidget;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
/**
* Funds transaction escrow payment field widget.
*/
#[FieldWidget(
id: "commerce_funds_transaction_escrow",
label: new TranslatableMarkup("Escrow payment"),
field_types: ["commerce_funds_transaction"],
)]
class FundsTransactionEscrowWidget extends FundsTransactionWidgetBase {
/**
* {@inheritdoc}
*/
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$element = parent::formElement($items, $delta, $element, $form, $form_state);
$element['target_id']['#transaction_type'] = 'escrow';
return $element;
}
}
