You are here

public function CmisCreateFolderForm::buildForm in CMIS API 8.2

Same name and namespace in other branches
  1. 8 src/Form/CmisCreateFolderForm.php \Drupal\cmis\Form\CmisCreateFolderForm::buildForm()
  2. 3.0.x src/Form/CmisCreateFolderForm.php \Drupal\cmis\Form\CmisCreateFolderForm::buildForm()

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 FormInterface::buildForm

File

src/Form/CmisCreateFolderForm.php, line 46

Class

CmisCreateFolderForm
Class CmisCreateFolder.

Namespace

Drupal\cmis\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->getRouteMatch()
    ->getParameter('config');
  $this->cmisConnectionApi
    ->checkConnectionIsAlive($config, TRUE);
  $form['folder_name'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Folder name'),
    '#description' => $this
      ->t('Enter the new folder name'),
    '#maxlength' => 255,
    '#size' => 64,
    '#required' => TRUE,
  ];
  $form['folder_description'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Folder description'),
    '#description' => $this
      ->t('Enter the folder description'),
  ];
  $form['config'] = [
    '#type' => 'hidden',
    '#default_value' => $config,
  ];
  $form['folder_id'] = [
    '#type' => 'hidden',
    '#default_value' => $this
      ->getRouteMatch()
      ->getParameter('folder_id'),
  ];
  $form['operation']['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Create folder'),
  ];
  return $form;
}