public function ImceProfileForm::folderForm in IMCE 8
Same name and namespace in other branches
- 8.2 src/Form/ImceProfileForm.php \Drupal\imce\Form\ImceProfileForm::folderForm()
Returns folder form elements.
1 call to ImceProfileForm::folderForm()
- ImceProfileForm::form in src/
Form/ ImceProfileForm.php - Gets the actual form array to be built.
File
- src/
Form/ ImceProfileForm.php, line 229
Class
- ImceProfileForm
- Base form for Imce Profile entities.
Namespace
Drupal\imce\FormCode
public function folderForm($index, array $folder = []) {
$folder += [
'path' => '',
'permissions' => [],
];
$form = [
'#type' => 'container',
'#attributes' => [
'class' => [
'folder-container',
],
],
];
$fieldPrefix = $this
->t('root');
$slach = '/';
$form['path'] = [
'#type' => 'textfield',
'#default_value' => $folder['path'],
'#field_prefix' => '<' . $fieldPrefix . '>' . $slach,
];
$form['permissions'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Permissions'),
'#attributes' => [
'class' => [
'folder-permissions',
],
],
];
$perms = $this
->permissionInfo();
$form['permissions']['all'] = [
'#type' => 'checkbox',
'#title' => $this
->t('All permissions'),
'#default_value' => isset($folder['permissions']['all']) ? $folder['permissions']['all'] : 0,
];
foreach ($perms as $perm => $title) {
$form['permissions'][$perm] = [
'#type' => 'checkbox',
'#title' => $title,
'#default_value' => isset($folder['permissions'][$perm]) ? $folder['permissions'][$perm] : 0,
'#states' => [
'disabled' => [
'input[name="conf[folders][' . $index . '][permissions][all]"]' => [
'checked' => TRUE,
],
],
],
];
}
return $form;
}