You are here

function skinr_ui_multiple_delete_confirm in Skinr 7.2

Same name and namespace in other branches
  1. 8.2 skinr_ui/skinr_ui.admin.inc \skinr_ui_multiple_delete_confirm()

Form builder for the confirmation form when deleting multiple Skinr settings.

Parameters

$skins: An array of skins to delete.

3 calls to skinr_ui_multiple_delete_confirm()
skinr_context_ui_admin_list in skinr_context/skinr_context_ui.admin.inc
Menu callback: skin configuration groups administration.
skinr_context_ui_admin_skin_list in skinr_context/skinr_context_ui.admin.inc
Overrides skinr_ui_list().
skinr_ui_list in ./skinr_ui.admin.inc
Menu callback: skin configurations administration.

File

./skinr_ui.admin.inc, line 578
Admin page callbacks for the Skinr UI module.

Code

function skinr_ui_multiple_delete_confirm($form, &$form_state, $skins) {
  $themes = list_themes();
  $form['skins'] = array(
    '#prefix' => '<ul>',
    '#suffix' => '</ul>',
    '#tree' => TRUE,
  );

  // array_filter returns only elements with TRUE values
  $original_skins = skinr_skin_load_multiple(array_keys($skins));
  foreach ($skins as $sid => $value) {
    $form['skins'][$sid] = array(
      '#type' => 'hidden',
      '#value' => $sid,
      '#prefix' => '<li>',
      '#suffix' => t('Skin %skin for element %element of type %type for the %theme theme', array(
        '%skin' => $original_skins[$sid]->skin,
        '%element' => $original_skins[$sid]->element,
        '%type' => $original_skins[$sid]->module,
        '%theme' => isset($themes[$original_skins[$sid]->theme]->info['name']) ? $themes[$original_skins[$sid]->theme]->info['name'] : $original_skins[$sid]->theme,
      )) . "</li>\n",
    );
  }
  $form['operation'] = array(
    '#type' => 'hidden',
    '#value' => 'delete',
  );
  $form['#submit'][] = 'skinr_ui_multiple_delete_confirm_submit';
  $confirm_question = format_plural(count($skins), 'Are you sure you want to delete this item?', 'Are you sure you want to delete these items?');
  return confirm_form($form, $confirm_question, 'admin/structure/skinr', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
}