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.
By asparagus on
Hello.
I'm trying to disable [ or rather render invisible ] certain aspects of a node edit form based on user roles.
what i've been doing is switching the content type from either 'fieldset' or 'textfield' etc, to 'value'. this seems to work on a simple test, but i'm wondering if anyone sees pitfalls to this approach.
thank you in advance.
Comments
noticed one issue
not sure if this is an error on submitting a form or desired functionality.
if is manually set the '#type' value of 'options' for a story node via
story-form.tpl.php
to 'value' instead of 'fieldset' then it does not take the default or existing value into account and all options are reset to '0'.i'm not changing any other value of the arrays. the contents of my
story-form.tpl.php
is below.another detail
I've tried simply looping through all of the 'options' setting and setting the '#type' to 'hidden'. This works, but leaves he fieldset tag, so i also get the border and title, but withough any contents. If i also set 'options' '#type' to 'hidden' then nothing prints. it would seem that i'm stuck showing this form section, but it seems like it shouldn't be so.
any thoughts?