function skinr_ui_multiple_delete_confirm in Skinr 8.2
Same name and namespace in other branches
- 7.2 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.
2 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().
File
- skinr_ui/
skinr_ui.admin.inc, line 379 - Admin page callbacks for the Skinr UI module.
Code
function skinr_ui_multiple_delete_confirm($form, &$form_state, $skins) {
$theme_handler = \Drupal::service('theme_handler');
$themes = $theme_handler
->listInfo();
$form['skins'] = array(
'#prefix' => '<ul>',
'#suffix' => '</ul>',
'#tree' => TRUE,
);
// array_filter returns only elements with TRUE values
$original_skins = entity_load_multiple('skin', 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'));
}