ThunderTermForm.php in Thunder 8.5
File
modules/thunder_taxonomy/src/ThunderTermForm.php
View source
<?php
namespace Drupal\thunder_taxonomy;
use Drupal\Core\Form\FormStateInterface;
use Drupal\taxonomy\TermForm;
class ThunderTermForm extends TermForm {
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$form['advanced'] = [
'#type' => 'container',
'#attributes' => [
'class' => [
'entity-meta',
],
],
'#weight' => 99,
];
$form['#theme'] = [
'node_edit_form',
];
$form['#attached']['library'][] = 'seven/node-form';
$form['relations']['#group'] = 'advanced';
$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;
}
}