lightmode hides unnecessary fields

This commit is contained in:
Robert Nasarek 2026-06-25 11:42:51 +02:00
parent 6526c6510a
commit f1d402e2b7

View file

@ -67,6 +67,19 @@ class DFG3dViewerConfigForm extends FormBase {
$form['#attached']['library'][] = 'dfg_3dviewer/dfg_3dviewer.config_form'; $form['#attached']['library'][] = 'dfg_3dviewer/dfg_3dviewer.config_form';
$full_mode_states = [
'visible' => [
':input[name="dfg_3dviewer_lightweight"]' => ['checked' => FALSE],
],
];
$form['dfg_3dviewer_lightweight'] = [
'#default_value' => $default_settings['lightweight'],
'#type' => 'checkbox',
'#title' => $this->t('<b>Lightweight</b> version. If checked, 3D Viewer will provide only basic operations.'),
'#required' => false,
];
$form['dfg_3dviewer_main_url'] = [ $form['dfg_3dviewer_main_url'] = [
'#default_value' => $default_settings['main_url'], '#default_value' => $default_settings['main_url'],
'#type' => 'textfield', '#type' => 'textfield',
@ -86,14 +99,16 @@ class DFG3dViewerConfigForm extends FormBase {
'#default_value' => $default_settings['metadata_url'], '#default_value' => $default_settings['metadata_url'],
'#type' => 'textfield', '#type' => 'textfield',
'#title' => $this->t('Metadata URL'), '#title' => $this->t('Metadata URL'),
'#description' => '<b>URL</b> of the instance that serves metadata content' '#description' => '<b>URL</b> of the instance that serves metadata content',
'#states' => $full_mode_states,
]; ];
$form['dfg_3dviewer_json_export_base_url'] = [ $form['dfg_3dviewer_json_export_base_url'] = [
'#default_value' => $default_settings['json_export_base_url'], '#default_value' => $default_settings['json_export_base_url'],
'#type' => 'textfield', '#type' => 'textfield',
'#title' => $this->t('JSON Export Base URL'), '#title' => $this->t('JSON Export Base URL'),
'#description' => '<b>Base URL</b> of the instance that serves JSON export, e.g. https://repository.covher.eu' '#description' => '<b>Base URL</b> of the instance that serves JSON export, e.g. https://repository.covher.eu',
'#states' => $full_mode_states,
]; ];
$form['dfg_3dviewer_container'] = [ $form['dfg_3dviewer_container'] = [
@ -133,21 +148,24 @@ class DFG3dViewerConfigForm extends FormBase {
'#type' => 'textfield', '#type' => 'textfield',
'#title' => $this->t('API 3D File Field'), '#title' => $this->t('API 3D File Field'),
'#required' => false, '#required' => false,
'#description' => '<b>ID or machine name</b> of the field that should populate API `3D_file`' '#description' => '<b>ID or machine name</b> of the field that should populate API `3D_file`',
'#states' => $full_mode_states,
]; ];
$form['dfg_3dviewer_image_generation'] = [ $form['dfg_3dviewer_image_generation'] = [
'#default_value' => $default_settings['image_generation'], '#default_value' => $default_settings['image_generation'],
'#type' => 'textfield', '#type' => 'textfield',
'#title' => $this->t('Image Generation'), '#title' => $this->t('Image Generation'),
'#description' => '<b>ID</b> of the bundle for the entity given in wisski pathbuilder for image_generation field' '#description' => '<b>ID</b> of the bundle for the entity given in wisski pathbuilder for image_generation field',
'#states' => $full_mode_states,
]; ];
$form['dfg_3dviewer_field_df'] = [ $form['dfg_3dviewer_field_df'] = [
'#default_value' => $default_settings['field_df'], '#default_value' => $default_settings['field_df'],
'#type' => 'textfield', '#type' => 'textfield',
'#title' => $this->t('Field DF'), '#title' => $this->t('Field DF'),
'#description' => 'Name of the field given for <b>field_df</b>' '#description' => 'Name of the field given for <b>field_df</b>',
'#states' => $full_mode_states,
]; ];
$form['dfg_3dviewer_export_viewer'] = [ $form['dfg_3dviewer_export_viewer'] = [
@ -155,6 +173,7 @@ class DFG3dViewerConfigForm extends FormBase {
'#type' => 'textfield', '#type' => 'textfield',
'#title' => $this->t('Export Viewer Field'), '#title' => $this->t('Export Viewer Field'),
'#description' => 'Name of the field given for <b>export_viewer</b>', '#description' => 'Name of the field given for <b>export_viewer</b>',
'#states' => $full_mode_states,
]; ];
$form['dfg_3dviewer_export_viewer_url'] = [ $form['dfg_3dviewer_export_viewer_url'] = [
@ -162,6 +181,7 @@ class DFG3dViewerConfigForm extends FormBase {
'#type' => 'textfield', '#type' => 'textfield',
'#title' => $this->t('Export Viewer URL'), '#title' => $this->t('Export Viewer URL'),
'#description' => 'URL for the export viewer', '#description' => 'URL for the export viewer',
'#states' => $full_mode_states,
]; ];
$form['scale_wrapper'] = [ $form['scale_wrapper'] = [
@ -197,7 +217,8 @@ class DFG3dViewerConfigForm extends FormBase {
'#type' => 'container', '#type' => 'container',
'#attributes' => [ '#attributes' => [
'class' => ['gallery-fields-wrapper', 'gallery-container'], 'class' => ['gallery-fields-wrapper', 'gallery-container'],
] ],
'#states' => $full_mode_states,
]; ];
$form['gallery_wrapper']['dfg_3dviewer_gallery_container'] = [ $form['gallery_wrapper']['dfg_3dviewer_gallery_container'] = [
@ -256,13 +277,6 @@ class DFG3dViewerConfigForm extends FormBase {
'#description' => '<b>ID</b> that allows get more specific data from WissKI', '#description' => '<b>ID</b> that allows get more specific data from WissKI',
]; ];
$form['dfg_3dviewer_lightweight'] = [
'#default_value' => $default_settings['lightweight'],
'#type' => 'checkbox',
'#title' => $this->t('<b>Lightweight</b> version. If checked, 3D Viewer will provide only basic operations.'),
'#required' => false
];
$form['submit'] = [ $form['submit'] = [
'#type' => 'submit', '#type' => 'submit',
'#value' => $this->t('Submit'), '#value' => $this->t('Submit'),