function ajax_example_advanced_commands_remove_callback

Callback for 'remove'.

See also

ajax_command_remove()

1 string reference to 'ajax_example_advanced_commands_remove_callback'
ajax_example_advanced_commands in ajax_example/ajax_example_advanced.inc
Form to display the AJAX Commands.

File

ajax_example/ajax_example_advanced.inc, line 361

Code

function ajax_example_advanced_commands_remove_callback($form, $form_state) {
    $commands = array();
    $should_remove = $form_state['values']['remove_command_example'];
    $should_remove_string = $should_remove ? 'TRUE' : 'FALSE';
    if ($should_remove) {
        $commands[] = ajax_command_remove('#remove_text');
    }
    else {
        $commands[] = ajax_command_html('#remove_div', "<div id='remove_text'>text to be removed</div>");
    }
    $commands[] = ajax_command_replace("#remove_status", "<div id='remove_status'>Updated remove_command_example (value={$should_remove_string} " . date('r') . "</div>");
    return array(
        '#type' => 'ajax',
        '#commands' => $commands,
    );
}