function lingotek_entity_delete_form in Lingotek Translation 7.7
Same name and namespace in other branches
- 7.5 lingotek.bulk_grid.inc \lingotek_entity_delete_form()
- 7.6 lingotek.bulk_grid.inc \lingotek_entity_delete_form()
Form constructor for the entity delete.
File
- ./
lingotek.bulk_grid.inc, line 3003
Code
function lingotek_entity_delete_form($form, &$form_state, $nids = array(), $collapse_fieldset = TRUE) {
if (isset($form_state['entity_ids'])) {
$entity_ids = $form_state['entity_ids'];
$collapse_fieldset = FALSE;
}
$form = array();
if (!is_array($entity_ids)) {
$entity_ids = array(
$entity_ids,
);
}
$entity_type = $form_state['entity_type'];
$content_details_string = $entity_type . ' ' . t("entity ids") . ': ' . implode(", ", $entity_ids) . "<br/>";
$content_description_message = $entity_type == 'config' ? '<br/>' . $content_details_string : $content_details_string;
$prefix_message = t('This action will apply to @count entities.');
$config_delete_message = t('Are you sure you want to delete these translations?');
$entity_delete_message = t('Are you sure you want to delete these entities?');
$message_description = t("Note: this action cannot be undone.");
$title_message = $entity_type == 'config' ? $config_delete_message : $entity_delete_message;
$form['confirm'] = array(
'#type' => 'fieldset',
'#prefix' => format_plural(count($entity_ids), '', '<div class="messages warning">' . filter_xss($message_description) . '</div>'),
'#title' => filter_xss($title_message),
'#description' => filter_xss($content_description_message, array(
'br',
)),
'#suffix' => '<i>' . filter_xss($message_description . '</i>'),
'#collapsible' => $collapse_fieldset,
'#collapsed' => $collapse_fieldset,
);
$submit_function = $entity_type === 'config' ? 'lingotek_config_delete_form_submit' : 'lingotek_entity_delete_form_submit';
$form['confirm']['submit'] = array(
'#type' => 'submit',
'#value' => t('Delete'),
'#submit' => array(
$submit_function,
),
);
$form['entity_ids'] = array(
'#type' => 'hidden',
'#value' => json_encode($entity_ids),
);
return $form;
}