You are here

public function PersianToolsAdminForm::buildForm in PersianTools 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/PersianToolsAdminForm.php, line 20

Class

PersianToolsAdminForm

Namespace

Drupal\persiantools\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = parent::buildForm($form, $form_state);
  $form['digit_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Digits and Numbers Settings'),
  );
  $form['digit_settings']['digit_method'] = array(
    '#type' => 'radios',
    '#title' => t('Conversion Method'),
    '#options' => array(
      'none' => t('None'),
      'smart' => t('Smart'),
      'full' => t('Full'),
    ),
    '#description' => t('Select method for converting english numbers to persian.'),
    '#default_value' => $this
      ->config('persiantools.settings')
      ->get('digit_method'),
  );
  $form['rtlmaker'] = array(
    '#type' => 'checkbox',
    '#title' => t('Fix multi-directional texts'),
    '#description' => t('Fix mess in mixed english and persian texts.'),
    '#default_value' => $this
      ->config('persiantools.settings')
      ->get('rtlmaker'),
  );
  $form['sort_fix'] = array(
    '#type' => 'fieldset',
    '#title' => t('Persian Sort'),
  );
  $form['sort_fix']['submit_btn'] = array(
    '#type' => 'submit',
    '#value' => t('Fix persian sort in all tables'),
    '#submit' => array(
      'persiantools_sort_fix_submit',
    ),
  );
  return $form;
}