public function StockSettingsForm::buildForm in Ubercart 8.4
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
- uc_stock/
src/ Form/ StockSettingsForm.php, line 61
Class
- StockSettingsForm
- Configure stock settings for this site.
Namespace
Drupal\uc_stock\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('uc_stock.settings');
$mail = $this
->config('uc_stock.mail');
$form['uc_stock_threshold_notification'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Send email notification when stock level reaches its threshold value'),
'#default_value' => $config
->get('notify'),
];
$form['uc_stock_threshold_notification_recipients'] = [
'#type' => 'textfield',
'#title' => $this
->t('Notification recipients'),
'#default_value' => $config
->get('recipients'),
'#description' => $this
->t('The list of comma-separated email addresses that will receive the notification.'),
];
$form['uc_stock_threshold_notification_subject'] = [
'#type' => 'textfield',
'#title' => $this
->t('Message subject'),
'#default_value' => $mail
->get('threshold_notification.subject'),
];
$form['uc_stock_threshold_notification_message'] = [
'#type' => 'textarea',
'#title' => $this
->t('Message text'),
'#default_value' => $mail
->get('threshold_notification.body'),
'#description' => $this
->t('The message the user receives when the stock level reaches its threshold value.'),
'#rows' => 10,
];
if ($this->moduleHandler
->moduleExists('token')) {
$form['token_tree'] = [
'#theme' => 'token_tree_link',
'#token_types' => [
'uc_order',
'uc_stock',
'node',
'site',
'store',
],
];
}
return parent::buildForm($form, $form_state);
}