You are here

public function SmartDateFormatSettingsForm::buildForm in Smart Date 3.2.x

Same name and namespace in other branches
  1. 8.2 src/Form/SmartDateFormatSettingsForm.php \Drupal\smart_date\Form\SmartDateFormatSettingsForm::buildForm()
  2. 8 src/Form/SmartDateFormatSettingsForm.php \Drupal\smart_date\Form\SmartDateFormatSettingsForm::buildForm()
  3. 3.x src/Form/SmartDateFormatSettingsForm.php \Drupal\smart_date\Form\SmartDateFormatSettingsForm::buildForm()
  4. 3.0.x src/Form/SmartDateFormatSettingsForm.php \Drupal\smart_date\Form\SmartDateFormatSettingsForm::buildForm()
  5. 3.1.x src/Form/SmartDateFormatSettingsForm.php \Drupal\smart_date\Form\SmartDateFormatSettingsForm::buildForm()
  6. 3.3.x src/Form/SmartDateFormatSettingsForm.php \Drupal\smart_date\Form\SmartDateFormatSettingsForm::buildForm()
  7. 3.4.x src/Form/SmartDateFormatSettingsForm.php \Drupal\smart_date\Form\SmartDateFormatSettingsForm::buildForm()

Defines the settings form for Smart Date Format entities.

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 Form definition array.

Overrides FormInterface::buildForm

File

src/Form/SmartDateFormatSettingsForm.php, line 55

Class

SmartDateFormatSettingsForm
Class SmartDateSettingsForm.

Namespace

Drupal\smart_date\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['searchoverride_settings']['#markup'] = 'Settings form for Smart date formats. Manage configuration here.';
  $config = $this
    ->config('searchoverride_settings.settings');
  $form['smart_date_format_path'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Search Path'),
    '#default_value' => $config
      ->get('path'),
    '#placeholder' => '/search',
    '#description' => $this
      ->t('The site-relative path to the search results page. Be sure to include the preceding slash'),
    '#required' => TRUE,
  ];
  $form['smart_date_format_parameter'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('URL Parameter'),
    '#placeholder' => 'query',
    '#default_value' => $config
      ->get('parameter'),
    '#description' => $this
      ->t('The URL parameter through which search keywords are passed'),
    '#required' => TRUE,
  ];
  $form['save'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Save'),
  ];
  return $form;
}