You are here

public function UploadForm::buildForm in Pack & Upload 8

Same name and namespace in other branches
  1. 2.0.x lib/Drupal/pack_upload/Form/UploadForm.php \Drupal\pack_upload\Form\UploadForm::buildForm()

Overrides FormInterface::buildForm

See also

\Drupal\Core\Form\FormInterface::buildForm()

File

lib/Drupal/pack_upload/Form/UploadForm.php, line 25
This file contains the code for upload form of zip.

Class

UploadForm

Namespace

Drupal\pack_upload\Form

Code

public function buildForm(array $form, array &$form_state) {
  $form['panel'] = array(
    '#title' => t('Bulk Media Uploader'),
    '#type' => 'fieldset',
  );
  $config = $this
    ->config('pack_upload.settings');
  $path = file_build_uri($config
    ->get('path'));
  $form['panel']['file'] = array(
    '#title' => t('Upload file'),
    '#type' => 'managed_file',
    '#upload_location' => $path,
    '#upload_validators' => array(
      'file_validate_extensions' => array(
        'zip tar tar.gz',
      ),
    ),
    '#description' => t('Create package of media files, for e.g., PDFs, images, text files and upload to Drupal. Valid extensions are .zip, .tar.gz, .tar. All files will be extracted to !directory', array(
      '!directory' => $path,
    )),
  );
  $form['panel']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  return $form;
}