Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm trying to hide the 'previous' and 'next' buttons via form_alter
, based on my specific conditions, but I can't. Why?
I'm using the follow code into form_alter:
$form['actions']['previous']['#access'] = FALSE;
Comment | File | Size | Author |
---|---|---|---|
#1 | msnf-disable_actions_buttons-2020253.patch | 7.08 KB | tregismoreira |
Comments
Comment #1
tregismoreira CreditAttribution: tregismoreira commentedSo... Since (mysteriously) it's not possible to disable this buttons in form alter, I was forced to implement a feature to disable these buttons in step configuration. The attached patch implements three new options:
Feedbacks are welcome! :)
Comment #2
fugazi CreditAttribution: fugazi commentedI would also appreciate a response form for the module authors know if you can use it that way.
regards
Comment #3
maijs CreditAttribution: maijs commentedMultistep Nodeform sets module weight to 100 upon installation (see
msnf_install()
in msnf.install) therefore you need to place your form alter hook in a module whose weight is greater than 100 in order to control the buttons added by Multistep Nodeform module.Comment #3.0
maijs CreditAttribution: maijs commentedFix the code.
Comment #4
bradjones1Status bump; I don't see why we couldn't add this option in the UI per this patch?
Comment #5
bradjones1Also one workaround here (without hacking module weights and waiting for this patch to be RTBC) is to add a function callback into the form's #pre_render array, where you can then make changes to the $form before it's rendered, but after MSNF has done its thing. The function signature is a little different from a form_alter but it's the same idea.
Comment #6
rooby CreditAttribution: rooby commentedComment #7
rooby CreditAttribution: rooby commentedComment #8
rooby CreditAttribution: rooby commentedMarked #2083905: Remove the back button capability. as duplicate of this.
Comment #9
rooby CreditAttribution: rooby commentedOops, sorry for the mis-titling and comment spam.
Comment #10
stBorchertCommitted some code so the buttons "previous", "next" and "skip" can be hidden using
hook_msnf_info_steps_alter()
.@see #1967306: Allow users to hide the skip button via hook_msnf_info_steps_alter() and msnf.api.php for further reference.