- π¨πΏCzech Republic parisek
Working great for me too. Tests are green. RTBC
Is there a way I could have the webform field disabled, but have the open/closed/scheduled status enabled? I have webform nodes, and I want editors to be able to open/close the webform without allowing them to change which webform is displayed.
- last update
about 1 year ago 535 pass - last update
about 1 year ago 535 pass - last update
about 1 year ago 535 pass - Status changed to Postponed
about 1 year ago 3:09pm 7 October 2023 - πΊπΈUnited States jrockowitz Brooklyn, NY
@parisek I appreciate your effort on the feature and patch. The webform module is running into a point where we need to slow down adding new features. You see how this feature request is snowballing into another reasonable feature request in #15.
At the same time, I think a well-documented form/element alter hook that documents how to hide the webform field properties. could be a reasonable compromise.
I am going to move to postponed to leave the discussion open.
Here's what I used.
function my_module_form_alter(array &$form, FormStateInterface $form_state, string $form_id): void { if ($form_id === 'node_webform_edit_form' || $form_id === 'node_webform_form') { if (!\Drupal::currentUser()->hasPermission('edit any webform')) { // Deny access to change which webform is shown. $form['webform']['widget'][0]['target_id']['#access'] = FALSE; // Deny access to edit webform settings YAML, if enabled. if (isset($form['webform']['widget'][0]['settings']['default_data'])) { $form['webform']['widget'][0]['settings']['default_data']['#access'] = FALSE; } } } }
- Status changed to Closed: won't fix
9 months ago 3:10pm 7 April 2024