public function DateFormatForm::buildForm in Booking and Availability Management Tools for Drupal 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/ DateFormatForm.php, line 35 - Contains \Drupal\bat\Form\DateFormatForm.
Class
Namespace
Drupal\bat\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('bat.settings');
$form['bat_date_format'] = [
'#type' => 'item',
'#title' => t('BAT PHP Date Format'),
'#description' => t("A custom date format for events, search summary and calendar pop-ups. Define a php date format string like 'Y-m-d H:i' (see <a href=\"@link\">http://php.net/date</a> for more details).", [
'@link' => 'http://php.net/date',
]),
];
$form['bat_date_format']['bat_date_format'] = [
'#type' => 'textfield',
'#size' => 12,
'#prefix' => '<div class="container-inline form-item">' . t('Date format') . ': ',
'#suffix' => '</div>',
'#default_value' => $config
->get('bat_date_format'),
];
$form['bat_date_format']['bat_daily_date_format'] = [
'#type' => 'textfield',
'#size' => 12,
'#prefix' => '<div class="container-inline form-item">' . t('Daily date format') . ': ',
'#suffix' => '</div>',
'#default_value' => $config
->get('bat_daily_date_format'),
];
return parent::buildForm($form, $form_state);
}