Skip to content

Commit

Permalink
Added check to not print file-location if user is not authenticated
Browse files Browse the repository at this point in the history
  • Loading branch information
magnarem committed Oct 17, 2023
1 parent a009fba commit 6b70e7c
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions metsis/metsis_lib/src/Form/StorageInformationForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Drupal\Core\Form\FormStateInterface;

/**
* Class StorageInformationForm.
* Prints dataset storage information.
*/
class StorageInformationForm extends FormBase {

Expand All @@ -30,7 +30,8 @@ public function buildForm(array $form, FormStateInterface $form_state, $fields =
];
}

if (isset($fields['storage_information_file_location'])) {
if ((isset($fields['storage_information_file_location'])
&& $this->currentUser()->isAuthenticated())) {
$form['file_location'] = [
'#type' => 'item',
'#title' => $this->t('File location:'),
Expand Down Expand Up @@ -84,16 +85,6 @@ public function buildForm(array $form, FormStateInterface $form_state, $fields =
return $form;
}

/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
foreach ($form_state->getValues() as $key => $value) {
// @todo Validate fields.
}
parent::validateForm($form, $form_state);
}

/**
* {@inheritdoc}
*/
Expand Down

0 comments on commit 6b70e7c

Please sign in to comment.