本文整理汇总了PHP中confirm_form函数的典型用法代码示例。如果您正苦于以下问题:PHP confirm_form函数的具体用法?PHP confirm_form怎么用?PHP confirm_form使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了confirm_form函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildForm
/**
* Form builder for report to Mollom form.
*
* @param $entity
* The entity type of the data to report, e.g. 'node' or 'comment'.
* @param $id
* The entity id the data belongs to.
*
* @see mollom_report_access()
*/
public function buildForm(array $form, FormStateInterface $form_state, $entity = NULL, $id = NULL)
{
$form['entity'] = array('#type' => 'value', '#value' => $entity);
$form['id'] = array('#type' => 'value', '#value' => $id);
// @todo "Delete" does not work for reporting mails to Mollom. In D7+, this
// form should be used solely for mails, as other entities are reported
// through existing delete confirmation forms instead. Perhaps there should
// be a dedicated form for reporting mails, as they are not really
// compatible with any of the standard processes either way.
$form = confirm_form($form, t('Are you sure you want to delete and report the content as inappropriate?'), '<front>', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
mollom_data_delete_form_alter($form, $form_state);
return $form;
}
示例2: snippet_revision_revert
/**
* Ask for confirmation of the reversion to prevent against CSRF attacks.
*/
function snippet_revision_revert($form, $form_state, $revision)
{
$form['#revision'] = $revision;
return confirm_form($form, t('Are you sure you want to revert to the revision from %revision-date?', array('%revision-date' => format_date($revision->timestamp))), SNIPPET_MENU_PREFIX . "/{$revision->name}/revision", t('This will revert the snippet %revision-title to revision %revision-date', array('%revision-title' => $revision->title, '%revision-date' => format_date($revision->timestamp))), t('Revert'), t('Cancel'));
}
示例3: ctools_export_ui_delete_confirm_form
/**
* Delete/Revert confirm form.
*
* @todo -- call back into the object instead.
*/
function ctools_export_ui_delete_confirm_form($form, &$form_state)
{
_ctools_export_ui_add_form_files($form, $form_state);
$plugin = $form_state['plugin'];
$item = $form_state['item'];
$form = array();
$export_key = $plugin['export']['key'];
$question = str_replace('%title', check_plain($item->{$export_key}), $plugin['strings']['confirmation'][$form_state['op']]['question']);
$path = !empty($_REQUEST['cancel_path']) && !url_is_external($_REQUEST['cancel_path']) ? $_REQUEST['cancel_path'] : ctools_export_ui_plugin_base_path($plugin);
$form = confirm_form($form, $question, $path, $plugin['strings']['confirmation'][$form_state['op']]['information'], $plugin['allowed operations'][$form_state['op']]['title'], t('Cancel'));
return $form;
}
示例4: deploy_ui_plan_confirm_form
/**
* Form for confirming the user wants to deploy this plan.
*/
function deploy_ui_plan_confirm_form($form, $form_state)
{
$plan = $form_state['plan'];
$path = 'admin/structure/deploy/plans';
if (!empty($_REQUEST['cancel_path']) && !url_is_external($_REQUEST['cancel_path'])) {
$path = $_REQUEST['cancel_path'];
}
if (empty($plan->processor) || $plan->fetch_only) {
drupal_set_message(t("The plan @name can't be deployed in push fashion because it missing a processor plugin or is configured <em>fetch-only</em>.", array('@name' => $plan->name)), 'error');
drupal_goto($path);
}
$form = array();
$form = confirm_form($form, t('Are you sure you want to deploy %title?', array('%title' => $plan->name)), $path, t("Deploying a plan will push its content to all its endpoints."), t('Deploy'), t('Cancel'));
return $form;
}
示例5: entityqueue_subqueue_delete_form
/**
* Form callback.
*/
function entityqueue_subqueue_delete_form($form, &$form_state, $queue, $subqueue)
{
$handler = entityqueue_get_handler($queue);
// If they can't delete this subqueue, return access denied.
if (!$handler->canDeleteSubqueue($subqueue)) {
drupal_set_message(t('The %queue: %subqueue subqueue cannot be deleted.', array('%queue' => $queue->label, '%subqueue' => $subqueue->label)), 'warning');
drupal_access_denied();
drupal_exit();
}
$form['#queue'] = $queue;
$form['#subqueue'] = $subqueue;
$form['subqueue_id'] = array('#type' => 'value', '#value' => $subqueue->subqueue_id);
return confirm_form($form, t('Are you sure you want to delete %queue: %subqueue?', array('%queue' => $queue->label, '%subqueue' => $subqueue->label)), 'admin/structure/entityqueue/list/' . $queue->name . '/subqueues', NULL, t('Delete'));
}
示例6: check_form
function check_form($fname, $lname, $email, $street, $city, $state, $zip)
{
if (empty(trim($fname))) {
echo "<h3> O campo First Name deve ser preenchido!</h3>";
print_form($fname, $lname, $email, $street, $city, $state, $zip);
} elseif (empty(trim($fname))) {
echo "<h3> O campo nome deve ser preenchido!</h3>";
print_form($fname, $lname, $email, $street, $city, $state, $zip);
} elseif (empty(trim($email)) || substr_count($email, '@') <= 0) {
echo "<h3>Email deve ser preenchido e conter @ !</h3>";
print_form($fname, $lname, $email, $street, $city, $state, $zip);
} else {
confirm_form($fname, $lname, $email, $street, $city, $state, $zip);
}
}
示例7: sopac_list_confirm_item_delete
function sopac_list_confirm_item_delete(&$form_state, $list_id, $bnum, $page = 0)
{
$insurge = sopac_get_insurge();
$items = $insurge->get_list_items($list_id);
$item = array();
foreach ($items as $i) {
if ($i['bnum'] == $bnum) {
$item = $i;
break;
}
}
if ($item['bnum']) {
$form = array('#list_id' => $list_id, '#item' => $item, '#page' => $page);
return confirm_form($form, t('Delete Item'), "user/lists/{$list_id}", t('Are you sure you want to delete this item from the list? This action cannot be undone.'), t('Delete'), t('Cancel'), 'sopac_list_confirm_item_delete');
} else {
drupal_set_message('Cannot find the specified item on this list', 'error');
drupal_goto("user/lists/{$list_id}");
}
}
示例8: guifi_devel_paramusc_delete_confirm
function guifi_devel_paramusc_delete_confirm($form_state, $id)
{
guifi_log(GUIFILOG_TRACE, 'guifi_devel_parameter_delete_confirm()', $id);
$form['id'] = array('#type' => 'hidden', '#value' => $id);
$qry = db_fetch_object(db_query("SELECT\n p.nom, pusc.uscid as uscid\n FROM\n guifi_parametresConfiguracioUnsolclic pusc\n inner join guifi_parametres p on p.id = pusc.pid\n WHERE\n pusc.id = %d", $id));
return confirm_form($form, t('Are you sure you want to delete the USC Configuration parameter " %parameter "?', array('%parameter' => $qry->nom)), "guifi/menu/devel/configuraciousc/{$qry->uscid}/edit", t('This action cannot be undone.'), t('Delete'), t('Cancel'));
}
示例9: unl_site_delete_confirm
/**
* Form to confirm UNL site delete operation.
*/
function unl_site_delete_confirm($form, &$form_state, $site_id)
{
$site_path = db_select('unl_sites', 's')->fields('s', array('site_path'))->condition('site_id', $site_id)->execute()->fetchCol();
$form['site_id'] = array('#type' => 'value', '#value' => $site_id);
$form['confirm_delete'] = array('#type' => 'checkbox', '#title' => t('Confirm'), '#description' => t('I am sure I want to permanently delete %site_path ?', array('%site_path' => $site_path[0])), '#required' => TRUE);
$form['confirm_again'] = array('#type' => 'checkbox', '#title' => t('Confirm again'), '#description' => t('Yes, I am absolutely sure I want to permanently delete this site.'), '#required' => TRUE);
return confirm_form($form, t('Are you sure you want to delete the site %site_path ?', array('%site_path' => $site_path[0])), 'admin/sites/unl', t('This action cannot be undone. DOUBLE CHECK WHICH CMS INSTANCE YOU ARE ON!'), t('Delete Site'));
}
示例10: sopac_admin_moderate_form
function sopac_admin_moderate_form($form_state, $type = 'reviews', $offset = 0)
{
include_once 'sopac_catalog.php';
$insurge = sopac_get_insurge();
$locum = sopac_get_locum();
$limit = 100;
// per page
if ($form_state['storage']['confirm_ids']) {
// CONFIRM FORM
$confirm_ids = $form_state['storage']['confirm_ids'];
$form['confirm_message'] = array('#prefix' => '<h2>Are you sure you want to delete these ' . $type . '?</h2><ul>', '#suffix' => '</ul>', '#tree' => TRUE);
if ($type == 'reviews') {
$reviews = $insurge->get_reviews(NULL, NULL, $confirm_ids, $limit);
$form['reviews'] = array('#type' => 'value', '#value' => $reviews['reviews']);
foreach ($reviews['reviews'] as $review) {
$form['confirm_message'][] = array('#value' => '<li>' . check_plain($review['rev_title']) . "</li>\n");
}
} else {
if ($type == 'tags') {
$tags = array();
foreach ($confirm_ids as $tag_id) {
$tag = $insurge->get_tag($tag_id);
$tags[] = $tag;
$form['confirm_message'][] = array('#value' => '<li>' . check_plain($tag['tag']) . "</li>\n");
}
$form['tags'] = array('#type' => 'value', '#value' => $tags);
}
}
$form['operation'] = array('#type' => 'hidden', '#value' => 'delete');
$form['#submit'][] = 'sopac_admin_moderate_delete_confirm_submit';
return confirm_form($form, t('Are you sure you want to delete these ' . $type . '?'), 'admin/settings/sopac/moderate/' . $type, t('This action cannot be undone.'), t('Delete all'), t('Cancel'));
} else {
// REVIEW FORM
if ($type == 'reviews') {
$reviews = $insurge->get_reviews(NULL, NULL, NULL, $limit, intval($offset));
$checkboxes = array();
$form = array();
foreach ($reviews['reviews'] as $review) {
$bib = $locum->get_bib_item($review['bnum'], TRUE);
// Hover text for the bib
$hover = $bib['title'] . "\n" . $bib['callnum'] . "\n" . $bib['pub_info'] . "\n" . $bib['descr'];
$checkboxes[$review['rev_id']] = '';
$account = user_load(array('uid' => $review['uid']));
$form[$review['rev_id']] = array('user' => array('#value' => l($account->name, 'user/' . $account->uid)), 'bnum' => array('#value' => l($bib['title'], 'catalog/record/' . $review['bnum'], array('attributes' => array('title' => $hover)))), 'title' => array('#value' => $review['rev_title']), 'body' => array('#value' => $review['rev_body']), 'created' => array('#value' => date("F j, Y, g:i a", $review['rev_create_date'])), 'update' => array('#value' => date("F j, Y, g:i a", $review['rev_last_update'])));
}
$form['checkboxes'] = array('#type' => 'checkboxes', '#options' => $checkboxes);
$form['operation'] = array('#type' => 'hidden', '#value' => 'delete');
$form['submit'] = array('#type' => 'submit', '#value' => t('Delete Selected Reviews'));
$form['next'] = array('#value' => '<p>' . l('NEXT PAGE', 'admin/settings/sopac/moderate/' . $type . '/' . ($offset + $limit)) . '</p>');
$form['#theme'] = 'sopac_admin_moderate_reviews';
} else {
if ($type == 'tags') {
$tags = $insurge->get_tags(1, $limit, $offset);
$checkboxes = array();
$form = array();
foreach ($tags as $tag) {
$bib = $locum->get_bib_item($tag['bnum'], TRUE);
// Hover text for the bib
$hover = $bib['title'] . "\n" . $bib['callnum'] . "\n" . $bib['pub_info'] . "\n" . $bib['descr'];
$checkboxes[$tag['tid']] = '';
$account = user_load(array('uid' => $tag['uid']));
$form[$tag['tid']] = array('user' => array('#value' => l($account->name, 'user/' . $account->uid)), 'bnum' => array('#value' => l($bib['title'], 'catalog/record/' . $tag['bnum'], array('attributes' => array('title' => $hover)))), 'tag' => array('#value' => $tag['tag']), 'created' => array('#value' => $tag['tag_date']), 'public' => array('#value' => $tag['public'] ? 'Public' : 'Private'));
}
$form['checkboxes'] = array('#type' => 'checkboxes', '#options' => $checkboxes);
$form['operation'] = array('#type' => 'hidden', '#value' => 'delete');
$form['submit'] = array('#type' => 'submit', '#value' => t('Delete Selected Tags'));
$form['next'] = array('#value' => '<p>' . l('NEXT PAGE', 'admin/settings/sopac/moderate/' . $type . '/' . ($offset + $limit)) . '</p>');
$form['#theme'] = 'sopac_admin_moderate_tags';
}
}
return $form;
}
}
示例11: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state)
{
$file_ids = array_filter($form_state->getValue('file_select'));
$form['file_ids'] = array('#type' => 'value', '#value' => $file_ids);
$form['action'] = array('#type' => 'value', '#value' => $form_state->getValue(['uc_file_action', 'action']));
$file_ids = _uc_file_sort_names(_uc_file_get_dir_file_ids($file_ids, FALSE));
switch ($form_state->getValue(['uc_file_action', 'action'])) {
case 'uc_file_delete':
$affected_list = _uc_file_build_js_file_display($file_ids);
$has_directory = FALSE;
foreach ($file_ids as $file_id) {
// Gather a list of user-selected filenames.
$file = uc_file_get_by_id($file_id);
$filename = $file->filename;
$file_list[] = substr($filename, -1) == "/" ? $filename . ' (' . t('directory') . ')' : $filename;
// Determine if there are any directories in this list.
$path = uc_file_qualify_file($filename);
if (is_dir($path)) {
$has_directory = TRUE;
}
}
// Base files/dirs the user selected.
$form['selected_files'] = array('#theme' => 'item_list', '#items' => $file_list, '#attributes' => array('class' => array('selected-file-name')));
$form = confirm_form($form, t('Delete file(s)'), 'admin/store/products/files', t('Deleting a file will remove all its associated file downloads and product features. Removing a directory will remove any files it contains and their associated file downloads and product features.'), t('Delete affected files'), t('Cancel'));
// Don't even show the recursion checkbox unless we have any directories.
if ($has_directory && $affected_list[TRUE] !== FALSE) {
$form['recurse_directories'] = array('#type' => 'checkbox', '#title' => t('Delete selected directories and their sub directories'));
// Default to FALSE. Although we have the JS behavior to update with the
// state of the checkbox on load, this should improve the experience of
// users who don't have JS enabled over not defaulting to any info.
$form['affected_files'] = array('#theme' => 'item_list', '#items' => $affected_list[FALSE], '#title' => t('Affected files'), '#attributes' => array('class' => array('affected-file-name')));
}
break;
case 'uc_file_upload':
// Calculate the max size of uploaded files, in bytes.
$max_bytes = trim(ini_get('post_max_size'));
switch (strtolower($max_bytes[strlen($max_bytes) - 1])) {
case 'g':
$max_bytes *= 1024;
case 'm':
$max_bytes *= 1024;
case 'k':
$max_bytes *= 1024;
}
// Gather list of directories under the selected one(s).
// '/' is always available.
$directories = array('' => '/');
$files = db_query("SELECT * FROM {uc_files}");
foreach ($files as $file) {
if (is_dir(\Drupal::config('uc_file.settings')->get('base_dir') . "/" . $file->filename)) {
$directories[$file->filename] = $file->filename;
}
}
$form['upload_dir'] = array('#type' => 'select', '#title' => t('Directory'), '#description' => t('The directory on the server where the file should be put. The default directory is the root of the file downloads directory.'), '#options' => $directories);
$form['upload'] = array('#type' => 'file', '#title' => t('File'), '#description' => t('The maximum file size that can be uploaded is %size bytes. You will need to use a different method to upload the file to the directory (e.g. (S)FTP, SCP) if your file exceeds this size. Files you upload using one of these alternate methods will be automatically detected.', ['%size' => number_format($max_bytes)]));
$form['#attributes']['class'][] = 'foo';
$form = confirm_form($form, t('Upload file'), 'admin/store/products/files', '', t('Upload file'), t('Cancel'));
// Must add this after confirm_form, as it runs over $form['#attributes'].
// Issue logged at d#319723
$form['#attributes']['enctype'] = 'multipart/form-data';
break;
default:
// This action isn't handled by us, so check if any
// hook_uc_file_action('form', $args) are implemented.
$module_handler = \Drupal::moduleHandler();
foreach ($module_handler->getImplementations('uc_file_action') as $module) {
$name = $module . '_uc_file_action';
$result = $name('form', array('action' => $form_state->getValue(['uc_file_action', 'action']), 'file_ids' => $file_ids));
$form = is_array($result) ? array_merge($form, $result) : $form;
}
break;
}
return $form;
}
示例12: guifi_user_delete_confirm
function guifi_user_delete_confirm($form_state, $username, $nid, $id)
{
guifi_log(GUIFILOG_TRACE, 'guifi_delete_user_confirm()', $username . '-' . $nid);
$form['id'] = array('#type' => 'hidden', '#value' => $id);
return confirm_form($form, t('Are you sure you want to delete the user %username?', array('%username' => $username)), 'node/' . $nid . '/view/users', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
}
示例13: guifi_ipv4_confirm_delete
/**
* Hook callback; delkete a network
*/
function guifi_ipv4_confirm_delete($form_state, $base, $mask, $zone)
{
return confirm_form(array(), t('Are you sure you want to delete the network range %base/%mask?', array('%base' => $base, '%mask' => $mask)), 'node/' . $zone . '/view/ipv4', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
}