You are here

public function ViewsJsonSourceSettingsForm::buildForm in Views Json Source 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/ViewsJsonSourceSettingsForm.php, line 32

Class

ViewsJsonSourceSettingsForm
Form for configure values.

Namespace

Drupal\views_json_source\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('views_json_source.settings');
  $form['cache_ttl'] = [
    '#type' => 'number',
    '#min' => 0,
    '#size' => 15,
    '#title' => $this
      ->t('Cache Duration (seconds)'),
    '#description' => $this
      ->t('The duration till when the cache needs to be active.<br>EG: 1 day = 86400 seconds.'),
    '#default_value' => $config
      ->get('cache_ttl'),
  ];
  return parent::buildForm($form, $form_state);
}