Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function my_module_menu() {
- $items = array();
- $items['admin/my-module/entity'] = array(
- 'title' => 'Test Page',
- 'description' => '',
- 'page callback' => 'my_module_test_page',
- 'access callback' => TRUE,
- 'type' => MENU_CALLBACK,
- );
- return $items;
- }
- function my_module_test_page() {
- $follow_up = my_entity_load(125);
- $render = render(field_view_field('my_entity', $follow_up, 'field_lt_reply'));
- return '<div id="replyblock-view-125">'.$render.'</div>';
- }
- function my_module_form_alter(&$form, &$form_state, $form_id) {
- if(substr($form_id,0,10)=='reply_form'){
- $form['actions']['submit']['#ajax'] = array(
- 'callback' => 'my_module_submit_callback',
- 'progress' => array('message' => '', 'type' => 'throbber'),
- );
- }
- }
- function my_module_submit_callback($form, $form_state) {
- $commands = array();
- $lid = 125;
- $follow_up = my_entity_load(125);
- $render = render(field_view_field('my_entity', $follow_up, 'field_lt_reply'));
- $newview = '<div id="replyblock-view-125">'.$render.'</div>';
- $commands[] = ajax_command_replace('#replyblock-view-125',$newview);
- return array('#type' => 'ajax', '#commands' => $commands);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement