You are here

public function FilebrowserFormController::form in Filebrowser 8

File

lib/Drupal/filebrowser/Entity/Form/FilebrowserFormController.php, line 18
Definition of Drupal\foo_bar\Entity\Form\FooBarFormController.

Class

FilebrowserFormController
Form controller for the filebrowser entity edit forms. Define the form for adding and editing entity content. It is called by the '_entity_form' definition in the routing.

Namespace

Drupal\filebrowser\Entity\Form

Code

public function form(array $form, array &$form_state) {

  /* @var $entity \Drupal\filebrowser\Entity\Filebrowser */
  $form = parent::form($form, $form_state);
  $entity = $this->entity;
  $form['user_id'] = array(
    '#type' => 'textfield',
    '#title' => 'UID',
    '#default_value' => $entity->user_id->target_id,
    '#size' => 60,
    '#maxlength' => 128,
    '#required' => TRUE,
    '#weight' => -10,
  );
  $form['langcode'] = array(
    '#title' => t('Language'),
    '#type' => 'language_select',
    '#default_value' => $entity
      ->getUntranslated()
      ->language()->id,
    '#languages' => Language::STATE_ALL,
  );
  return $form;
}