Last active
February 18, 2016 03:33
-
-
Save mikeyjk/a71d47f70749fcf030b7 to your computer and use it in GitHub Desktop.
Attach #after_build to field in form_alter.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function hook_form_alter(&$form, &$form_state, $form_id) { | |
if ($form_id === 'expected_form_name') { // Assuming content type containing list field. | |
if (isset($form['field_settings_list'])) { | |
$settingsForm = &$form['field_settings_list']; | |
$settingsLang = $settingsForm['#language']; | |
$settingsForm[$settingsLang]['#after_build'][] = 'field_settings_list_after_build'; | |
} | |
} | |
} | |
// Render array for list field children is now populated. | |
function field_settings_list_after_build(&$form, $form_state) { | |
$lang = $form['#language']; | |
$settings = $form_state['values']['field_settings_list'][$lang]; | |
$form['feedbackRequired']['#attributes']['disabled'] = 'disabled'; | |
return $form; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment