public ConfigImportForm::buildForm(array $form, FormStateInterface $form_state)
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
- core/modules/config/src/Form/ConfigImportForm.php, line 52
Class
- ConfigImportForm
- Defines the configuration import form.
Namespace
Drupal\config\Form
Code
public function buildForm(array $form, FormStateInterface $form_state) { $directory = config_get_config_directory(CONFIG_SYNC_DIRECTORY); $directory_is_writable = is_writable($directory); if (!$directory_is_writable) { drupal_set_message($this->t('The directory %directory is not writable.', ['%directory' => $directory]), 'error'); } $form['import_tarball'] = array( '#type' => 'file', '#title' => $this->t('Configuration archive'), '#description' => $this->t('Allowed types: @extensions.', array('@extensions' => 'tar.gz tgz tar.bz2')), ); $form['submit'] = array( '#type' => 'submit', '#value' => $this->t('Upload'), '#disabled' => !$directory_is_writable, ); return $form; }
Please login to continue.