function _formdefaults_hide_field in Form Defaults 8
Same name and namespace in other branches
- 5.3 formdefaults.module \_formdefaults_hide_field()
- 6.2 formdefaults.module \_formdefaults_hide_field()
- 7 formdefaults.module \_formdefaults_hide_field()
Hide a field by turning it into a value or markup field.
Parameters
array $fieldvalue:
1 call to _formdefaults_hide_field()
- _formdefaults_hide_recursive in ./
formdefaults.module - Recursively iterate through all form elements and hide all children.
File
- ./
formdefaults.module, line 148
Code
function _formdefaults_hide_field(&$fieldvalue) {
//drupal_set_message($fieldname.":".$formreplace[$fieldname]['hide_it']);
switch ($fieldvalue['#type']) {
case "fieldset":
case "markup":
$h_type = 'value';
$fieldvalue['#value'] = '';
break;
default:
$h_type = 'value';
break;
}
$fieldvalue['#type'] = $h_type;
if (!array_key_exists('#value', $fieldvalue)) {
$fieldvalue['#value'] = $fieldvalue['#default_value'];
}
}