public function FolderForm::buildForm in Filebrowser 3.x
Same name and namespace in other branches
- 8.2 src/Form/FolderForm.php \Drupal\filebrowser\Form\FolderForm::buildForm()
Overrides FormInterface::buildForm
File
- src/
Form/ FolderForm.php, line 47
Class
Namespace
Drupal\filebrowser\FormCode
public function buildForm(array $form, FormStateInterface $form_state, $nid = null, $relative_fid = null, $fids = null, $ajax = null) {
$this->common = \Drupal::service('filebrowser.common');
$this->relativeRoot = $this->common
->relativePath($relative_fid);
$this->node = Node::load($nid);
$this->relativeFid = $relative_fid;
// If this form is to be presented in a slide-down window we
// will set the attributes and at a close-window link
if ($ajax) {
$form['#attributes'] = [
'class' => [
'form-in-slide-down',
],
];
$form['close-window'] = $this->common
->closeButtonMarkup();
}
$form['#tree'] = true;
$form['folder_name'] = [
'#type' => 'textfield',
'#title' => $this
->t('Folder Name'),
'#size' => 40,
'#description' => $this
->t('This folder will be created within the current directory.'),
'#required' => true,
];
$form['create'] = [
'#type' => 'submit',
'#value' => $this
->t('Create'),
'#name' => 'create',
];
$form['#attached']['library'][] = 'core/drupal.dialog.ajax';
$form['#attached']['library'][] = 'filebrowser/filebrowser-styles';
return $form;
}