makemeeting.pages.inc in Make Meeting Scheduler 7.2
File
makemeeting.pages.inc
View source
<?php
function makemeeting_delete_answer($form, &$form_state, $answer, $redirect = TRUE) {
$form['#answer'] = $answer;
return confirm_form($form, t('Are you sure you want to delete the answer?'), '');
}
function makemeeting_delete_answer_submit($form, &$form_state) {
$answer = $form['#answer'];
db_delete('makemeeting_answers')
->condition('answer_id', $answer->answer_id)
->execute();
_makemeeting_clear_related_entity_cache($answer->entity_type, $answer->entity_id);
}
function makemeeting_edit_answer($answer, $type = 'ajax') {
$entities = entity_load($answer->entity_type, [
$answer->entity_id,
]);
if (empty($entities)) {
return drupal_not_found();
}
$entity = $entities[$answer->entity_id];
$field = $entity->{$answer->field_name}[$answer->language][$answer->delta];
$form = drupal_get_form('makemeeting_answers_form_' . $answer->entity_id, $field, (array) $answer, $answer);
if ($type == 'ajax') {
$form['#theme'] = 'makemeeting_answer_row';
$form['#action'] = str_replace('/ajax/', '/nojs/', $form['#action']);
$colspan = 1 + count(element_children($form['answers']));
$output = '<tr class="editing"><td colspan="' . $colspan . '">' . drupal_render($form) . '</td></tr>';
$commands = [];
$commands[] = ajax_command_replace('#answer-' . $answer->answer_id, $output);
$page = [
'#type' => 'ajax',
'#commands' => $commands,
];
return ajax_deliver($page);
}
return $form;
}