You are here

function commerce_product_product_delete_form in Commerce Core 7

Form callback: confirmation form for deleting a product.

Parameters

$product: The product object to be deleted.

See also

confirm_form()

1 string reference to 'commerce_product_product_delete_form'
commerce_product_ui_forms in modules/product/commerce_product_ui.module
Implements hook_forms().

File

modules/product/includes/commerce_product.forms.inc, line 221
Forms for creating, editing, and deleting products.

Code

function commerce_product_product_delete_form($form, &$form_state, $product) {
  $form_state['product'] = $product;

  // Ensure this include file is loaded when the form is rebuilt from the cache.
  $form_state['build_info']['files']['form'] = drupal_get_path('module', 'commerce_product') . '/includes/commerce_product.forms.inc';
  $form['#submit'][] = 'commerce_product_product_delete_form_submit';
  $content = entity_view('commerce_product', array(
    $product->product_id => $product,
  ));
  $form = confirm_form($form, t('Are you sure you want to delete %title?', array(
    '%title' => $product->title,
  )), '', drupal_render($content) . '<p>' . t('Deleting this product cannot be undone.', array(
    '@sku' => $product->sku,
  )) . '</p>', t('Delete'), t('Cancel'), 'confirm');
  return $form;
}