public function ThunderTermForm::form in Thunder 8.2
Same name and namespace in other branches
- 8.5 modules/thunder_taxonomy/src/ThunderTermForm.php \Drupal\thunder_taxonomy\ThunderTermForm::form()
- 8.3 modules/thunder_taxonomy/src/ThunderTermForm.php \Drupal\thunder_taxonomy\ThunderTermForm::form()
- 8.4 modules/thunder_taxonomy/src/ThunderTermForm.php \Drupal\thunder_taxonomy\ThunderTermForm::form()
- 6.0.x modules/thunder_taxonomy/src/ThunderTermForm.php \Drupal\thunder_taxonomy\ThunderTermForm::form()
- 6.1.x modules/thunder_taxonomy/src/ThunderTermForm.php \Drupal\thunder_taxonomy\ThunderTermForm::form()
Gets the actual form array to be built.
Overrides TermForm::form
See also
\Drupal\Core\Entity\EntityForm::processForm()
\Drupal\Core\Entity\EntityForm::afterBuild()
File
- modules/
thunder_taxonomy/ src/ ThunderTermForm.php, line 16
Class
- ThunderTermForm
- Base for handler for taxonomy term edit forms.
Namespace
Drupal\thunder_taxonomyCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
// Hide status checkbox. We have the button.
$form['status']['#group'] = 'footer';
// Create sidebar group.
$form['advanced'] = [
'#type' => 'container',
'#attributes' => [
'class' => [
'entity-meta',
],
],
'#weight' => 99,
];
// Use the same form like node edit.
$form['#theme'] = [
'node_edit_form',
];
$form['#attached']['library'][] = 'seven/node-form';
// Move relations into sidebar.
$form['relations']['#group'] = 'advanced';
// Move pathauto into sidebar.
$term = $form_state
->getFormObject()
->getEntity();
$form['path_settings'] = [
'#type' => 'details',
'#title' => $this
->t('URL path settings'),
'#open' => !empty($form['path']['widget'][0]['alias']['#value']),
'#group' => 'advanced',
'#access' => !empty($form['path']['#access']) && $term
->hasField('path') && $term
->get('path')
->access('edit'),
'#attributes' => [
'class' => [
'path-form',
],
],
'#attached' => [
'library' => [
'path/drupal.path',
],
],
'#weight' => 30,
];
$form['path']['#group'] = 'path_settings';
return $form;
}