You are here

public function CmisConnectionEntityForm::form in CMIS API 8.2

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

Gets the actual form array to be built.

Overrides EntityForm::form

See also

\Drupal\Core\Entity\EntityForm::processForm()

\Drupal\Core\Entity\EntityForm::afterBuild()

File

src/Form/CmisConnectionEntityForm.php, line 20

Class

CmisConnectionEntityForm
Provides a form to create CMIS connection.

Namespace

Drupal\cmis\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);
  $cmis_connection_entity = $this->entity;
  $form['label'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Label'),
    '#maxlength' => 255,
    '#default_value' => $cmis_connection_entity
      ->label(),
    '#description' => $this
      ->t('Label for the CMIS connection.'),
    '#required' => TRUE,
  ];
  $form['id'] = [
    '#type' => 'machine_name',
    '#default_value' => $cmis_connection_entity
      ->id(),
    '#machine_name' => [
      'exists' => '\\Drupal\\cmis\\Entity\\CmisConnectionEntity::load',
    ],
    '#disabled' => !$cmis_connection_entity
      ->isNew(),
  ];
  $form['cmis_url'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('CMIS browser url'),
    '#maxlength' => 255,
    '#default_value' => $cmis_connection_entity
      ->getCmisUrl(),
    '#description' => $this
      ->t('Enter CMIS browser url. Example: http://my-cmis.com/alfresco/api/-default-/public/cmis/versions/1.1/browser'),
    '#required' => TRUE,
  ];
  $form['cmis_user'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('CMIS user'),
    '#maxlength' => 255,
    '#default_value' => $cmis_connection_entity
      ->getCmisUser(),
    '#description' => $this
      ->t('Enter CMIS user name.'),
    '#required' => TRUE,
  ];
  $form['cmis_password'] = [
    '#type' => 'password',
    '#title' => $this
      ->t('CMIS password'),
    '#maxlength' => 255,
    '#default_value' => $cmis_connection_entity
      ->getCmisPassword(),
    '#description' => $this
      ->t('Enter CMIS password.'),
    '#required' => TRUE,
  ];
  $form['cmis_repository'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('CMIS repository id'),
    '#maxlength' => 255,
    '#default_value' => $cmis_connection_entity
      ->getCmisRepository(),
    '#description' => $this
      ->t('Enter CMIS repository id. If empty the first repository will be used'),
    '#required' => FALSE,
  ];
  $form['cmis_root_folder'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('CMIS folder id'),
    '#maxlength' => 255,
    '#default_value' => $cmis_connection_entity
      ->getCmisRootFolder(),
    '#description' => $this
      ->t('Enter CMIS root folder id. If empty the root folder will be used'),
    '#required' => FALSE,
  ];
  $form['cmis_cacheable'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('CMIS cacheable'),
    '#default_value' => $cmis_connection_entity
      ->getCmisCacheable(),
    '#description' => $this
      ->t('Check if repository will be cacheable'),
    '#required' => FALSE,
  ];
  return $form;
}