function _makemeeting_render_cell_name in Make Meeting Scheduler 7.2
Render the cell containing the submitter's name with a possible option to delete the answer
1 call to _makemeeting_render_cell_name()
- theme_makemeeting_answers in ./
makemeeting.theme.inc - Function used to render answers' table
File
- ./
makemeeting.theme.inc, line 357
Code
function _makemeeting_render_cell_name($uid, $name, $answer_id) {
global $user;
if ($uid) {
$account = user_load($uid);
$username = theme('username', array(
'account' => user_load($account->uid),
));
}
else {
$username = $name;
}
if (!user_access(MAKEMEETING_DELETE_PERM) && !user_access(MAKEMEETING_EDIT_PERM) && (user_is_anonymous() || $uid != $user->uid)) {
return array(
'#markup' => $username,
);
}
$images_path = drupal_get_path('module', 'makemeeting') . '/images/';
$cell[] = array(
'#prefix' => '<div class="answer-edit">',
'delete-link' => array(
'#type' => 'link',
'#title' => theme_image(array(
'path' => $images_path . 'trash.png',
'attributes' => array(
'title' => t('Delete answer'),
),
)),
'#href' => 'makemeeting/delete-answer/' . $answer_id,
'#options' => array(
'query' => drupal_get_destination(),
'html' => TRUE,
'attributes' => array(
'rel' => 'nofollow',
),
),
'#access' => user_access(MAKEMEETING_DELETE_PERM) || $uid == $user->uid,
),
'edit-link' => array(
'#type' => 'link',
'#title' => theme_image(array(
'path' => $images_path . 'pen.png',
'attributes' => array(
'title' => t('Edit answer'),
),
)),
// Note the /nojs portion of the href - if javascript is enabled,
// this part will be stripped from the path before it is called.
'#href' => 'makemeeting/edit-answer/' . $answer_id . '/nojs/',
'#options' => array(
'query' => drupal_get_destination(),
'html' => TRUE,
'attributes' => array(
'rel' => 'nofollow',
),
),
'#ajax' => array(
'wrapper' => 'answer-' . $answer_id,
'method' => 'html',
),
'#access' => user_access(MAKEMEETING_EDIT_PERM) || $uid == $user->uid,
),
'#suffix' => '</div>',
'#attached' => array(
'js' => array(
drupal_get_path('module', 'makemeeting') . '/makemeeting.js',
),
),
);
$cell[] = array(
'#markup' => $username,
);
return array(
'#markup' => '<div class="answer-editable">' . drupal_render($cell) . '</div>',
'#editable' => TRUE,
);
}