public function CreditMessagingForm::buildForm in Commerce PayPal 8
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfigFormBase::buildForm
File
- src/
Form/ CreditMessagingForm.php, line 32
Class
- CreditMessagingForm
- Provides a configuration form for PayPal credit messaging.
Namespace
Drupal\commerce_paypal\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('commerce_paypal.credit_messaging_settings');
$form['client_id'] = [
'#type' => 'textfield',
'#title' => $this
->t('PayPal Client ID'),
'#description' => $this
->t('You must supply a PayPal client ID for messaging to appear where you have enabled it.'),
'#default_value' => $config
->get('client_id'),
'#required' => FALSE,
];
$form['add_to_cart'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable PayPal Credit messaging on Add to Cart forms.'),
'#default_value' => $config
->get('add_to_cart'),
];
return parent::buildForm($form, $form_state);
}