Skip to content

Commit d1fcdd5

Browse files
Hide metadata fields from all users
1 parent 04a8f9b commit d1fcdd5

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

web/profiles/custom/os2loop/modules/os2loop_question/src/Helper/Helper.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function alterForm(array &$form, FormStateInterface $form_state, string $
4141
case 'node_os2loop_question_form':
4242
$this->alterContentForm($form, $form_state, $form_id);
4343
$this->handleTextFormats($form, $form_state, $form_id);
44+
$this->hideMetadata($form, $form_state, $form_id);
4445
break;
4546
}
4647
}
@@ -92,6 +93,31 @@ private function alterContentForm(array &$form, FormStateInterface $form_state,
9293
}
9394
}
9495

96+
/**
97+
* Hide metadata fields (if set) for all users.
98+
*
99+
* @param array $form
100+
* The form being altered.
101+
* @param \Drupal\Core\Form\FormStateInterface $form_state
102+
* The state of the form.
103+
* @param string $form_id
104+
* The id of the the form.
105+
*/
106+
private function hideMetadata(array &$form, FormStateInterface $form_state, string $form_id) {
107+
$hiddenMetadataFields = [
108+
'menu',
109+
'revision_information',
110+
'os2loop_question_answers',
111+
'meta',
112+
];
113+
114+
foreach ($hiddenMetadataFields as $field) {
115+
if (isset($form[$field])) {
116+
unset($form[$field]);
117+
}
118+
}
119+
}
120+
95121
/**
96122
* Hide preview button in form.
97123
*

web/profiles/custom/os2loop/themes/os2loop_theme/assets/signifly-custom/forms/node-os2loop-question-form.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
.legend-text {
1212
font-size: $font-size-base;
1313

14-
height: 100%;
1514
margin: 0;
1615
}
1716

0 commit comments

Comments
 (0)