You are here

public function CleanPagerSettingsForm::buildForm in Clean Pagination 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/CleanPagerSettingsForm.php, line 37

Class

CleanPagerSettingsForm
Defines a form to configure module settings.

Namespace

Drupal\cleanpager\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this->configFactory
    ->get('cleanpager.settings');
  $settings = $config
    ->get();
  $form['settings'] = array(
    '#tree' => TRUE,
  );
  $form['settings']['cleanpager_pages'] = array(
    '#type' => 'textarea',
    '#title' => t('Pages'),
    '#description' => t('Please set your pages where clean pagination should work. One path - one line.'),
    '#default_value' => isset($settings['cleanpager_pages']) ? $settings['cleanpager_pages'] : '',
  );
  $form['settings']['cleanpager_add_trailing'] = array(
    '#title' => t('Add trailing slash'),
    '#description' => t('Add a trailing slash (/) to all urls generated by Clean Pagination. I.E. "pager_url/page/1/"'),
    '#type' => 'checkbox',
    '#default_value' => isset($settings['cleanpager_add_trailing']) ? $settings['cleanpager_add_trailing'] : FALSE,
  );
  return parent::buildForm($form, $form_state);
}