MailchimpEcommerceSyncOrders.php in Mailchimp E-Commerce 8
File
src/Form/MailchimpEcommerceSyncOrders.php
View source
<?php
namespace Drupal\mailchimp_ecommerce\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
abstract class MailchimpEcommerceSyncOrders extends FormBase {
public function getFormId() {
return 'mailchimp_ecommerce_sync';
}
public function buildForm(array $form, \Drupal\Core\Form\FormStateInterface $form_state) {
$form['sync_orders'] = [
'#type' => 'checkbox',
'#title' => t('Sync Orders'),
'#description' => t('Sync all existing Orders to Mailchimp.'),
];
$form['timespan'] = [
'#type' => 'textfield',
'#title' => t('Time span'),
'#default_value' => 6,
'#field_suffix' => 'months',
'#description' => 'Mailchimp recommends syncing the past 6 months of order data. Leave blank to sync all orders.',
'#size' => 3,
'#maxlength' => 3,
];
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Sync with Mailchimp'),
'#button_type' => 'primary',
];
return $form;
}
public function submitForm(array &$form, FormStateInterface $form_state) {
$this
->_submitForm($form, $form_state);
}
public abstract function _submitForm($form, $form_state);
}