public function CommerceRepeatOrderSettingsForm::buildForm in Commerce Repeat Order 8
Same name and namespace in other branches
- 8.2 src/Form/CommerceRepeatOrderSettingsForm.php \Drupal\commerce_repeat_order\Form\CommerceRepeatOrderSettingsForm::buildForm()
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/ CommerceRepeatOrderSettingsForm.php, line 30
Class
Namespace
Drupal\commerce_repeat_order\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('commerce_repeat_order.settings');
$form['add_or_override'] = [
'#title' => $this
->t("Add Product or Override Products"),
'#description' => $this
->t("Add product to existing cart or override existing cart"),
'#type' => 'radios',
'#options' => [
'add' => $this
->t('Add Product'),
'override' => $this
->t('Override'),
],
'#required' => TRUE,
'#default_value' => $config
->get('add_or_override'),
];
$form['status_message'] = [
'#title' => $this
->t("Show/Hide add to cart status message"),
'#description' => $this
->t("show or hide add to cart set message of product"),
'#type' => 'radios',
'#options' => [
'show' => $this
->t('Show'),
'hide' => $this
->t('Hide'),
],
'#required' => TRUE,
'#default_value' => $config
->get('status_message'),
];
return parent::buildForm($form, $form_state);
}