You are here

public function CmisConnectionEntityForm::form in CMIS API 8

Same name and namespace in other branches
  1. 8.2 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 19

Class

CmisConnectionEntityForm
Class CmisConnectionEntityForm.

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'] = array(
    '#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'] = array(
    '#type' => 'machine_name',
    '#default_value' => $cmis_connection_entity
      ->id(),
    '#machine_name' => array(
      'exists' => '\\Drupal\\cmis\\Entity\\CmisConnectionEntity::load',
    ),
    '#disabled' => !$cmis_connection_entity
      ->isNew(),
  );
  $form['cmis_url'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('CMIS browser url'),
    '#maxlength' => 255,
    '#default_value' => $cmis_connection_entity
      ->getCmisUrl(),
    '#description' => $this
      ->t("Enter CMIS browser url."),
    '#required' => TRUE,
  );
  $form['cmis_user'] = array(
    '#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'] = array(
    '#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'] = array(
    '#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_cacheable'] = array(
    '#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;
}