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 have come across this issue a number of times where I call the various functions but I get no output. Please refer to the code beneath:
variable_set('data', array('N/A', 'FirstName', 'LastName', 'AddressLine#1', 'AddressLine#2', 'AddressLine#3', 'Town/City', 'PostCode', 'Country', 'Email'));
function mymodule_form_alter(&$form, &$form_state, $form_id){
$form['my_form']['container'] = array(
'#type' => 'fieldset',
'#title' => t('Data fieldset'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => 50,
);
$form['my_form']['container']['field_options'] = array(
'#type' => 'select',
'#title' => t('Data field options'),
'#options' => variable_get('data'),
'#description' => t('<em>Select the type of data</em>'),
);
$form['#submit'][] = '_data_settings';
}
function _data_settings(&$form, &$form_state){
// print("<pre>");
// print_r($form_state);
// print("</pre>");
// die();
drupal_set_message("TESTING TESTING!");
dsm($form_state);
}
As you can see I am calling the dsm function with an argument of $form_state. I get no response.
The drupal_set_message function call DOES respond.
If I use the print_r code above it, I see the form output but dsm, dvm and dpr don't respond.
Can you help with this?
Comments
Comment #1
salvisHave you updated to the -dev version yet?
Have you tried
dpm("TESTING TESTING!");
?Comment #2
yash_khandelwalHi,
While using dsm()/ dpm() or dvm(), first you should install and enable devel module on your drupal project.
Also just add submit button in form. Then submit handler ($form['#submit'][]) works.
Below code worked for me. Try it.
Comment #3
yash_khandelwalComment #4
yash_khandelwalComment #5
yash_khandelwalComment #6
yash_khandelwalComment #7
salvisWould you like to work on this? Then please open it and let us know your intentions.