You are here

function sharebar_button_confirm_delete in ShareBar 6

Same name and namespace in other branches
  1. 7.2 sharebar.admin.inc \sharebar_button_confirm_delete()
  2. 7 sharebar.admin.inc \sharebar_button_confirm_delete()

Form builder: delete buttons.

1 string reference to 'sharebar_button_confirm_delete'
sharebar_menu in ./sharebar.module
Implements hook_menu().

File

./sharebar.admin.inc, line 142
Admin page callbacks for the block module.

Code

function sharebar_button_confirm_delete(&$form_state) {
  $mname = arg(4);
  if ($mname) {
    $buttons = unserialize(variable_get('sharebar_buttons', sharebar_buttons_def()));
    if (is_array($buttons) && count($buttons)) {
      $button = $buttons[$mname];
    }
  }

  // Always provide entity id in the same form key as in the entity edit form.
  $form['machine_name'] = array(
    '#type' => 'value',
    '#value' => $button->machine_name,
  );
  $form['type'] = array(
    '#type' => 'value',
    '#value' => 'button',
  );
  $form['name'] = array(
    '#type' => 'value',
    '#value' => $button->name,
  );
  $form['delete'] = array(
    '#type' => 'value',
    '#value' => TRUE,
  );
  return confirm_form($form, t('Are you sure you want to delete the button %title?', array(
    '%title' => $button->name,
  )), 'admin/settings/sharebar', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
}