Skip to content
Snippets Groups Projects
Commit ded653fb authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #128866 by Gabor and erdemkose: make it impossible to delete the...

- Patch #128866 by Gabor and erdemkose: make it impossible to delete the default language or the English language.
parent dcbb5fa3
No related branches found
Tags 9.3.0-alpha1
No related merge requests found
......@@ -95,10 +95,11 @@ function _locale_admin_manage_screen() {
* Theme the admin langauge manager form.
*/
function theme_locale_admin_manage_screen($form) {
$default = language_default();
foreach ($form['name'] as $key => $element) {
// Do not take form control structures.
if (is_array($element) && element_child($key)) {
$rows[] = array(array('data' => drupal_render($form['enabled'][$key]), 'align' => 'center'), check_plain($key), '<strong>'. drupal_render($form['name'][$key]) .'</strong>', drupal_render($form['native'][$key]), drupal_render($form['direction'][$key]), drupal_render($form['site_default'][$key]), drupal_render($form['weight'][$key]), l(t('edit'), 'admin/build/locale/language/edit/'. $key). ($key != 'en' ? ' ' .l(t('delete'), 'admin/build/locale/language/delete/'. $key) : ''));
$rows[] = array(array('data' => drupal_render($form['enabled'][$key]), 'align' => 'center'), check_plain($key), '<strong>'. drupal_render($form['name'][$key]) .'</strong>', drupal_render($form['native'][$key]), drupal_render($form['direction'][$key]), drupal_render($form['site_default'][$key]), drupal_render($form['weight'][$key]), l(t('edit'), 'admin/build/locale/language/edit/'. $key). (($key != 'en' && $key != $default->language) ? ' '. l(t('delete') ,'admin/build/locale/language/delete/'. $key) : ''));
}
}
$header = array(array('data' => t('Enabled')), array('data' => t('Code')), array('data' => t('English name')), array('data' => t('Native name')), array('data' => t('Direction')), array('data' => t('Default')), array('data' => t('Weight')), array('data' => t('Operations')));
......
......@@ -357,6 +357,12 @@ function locale_admin_manage_delete_form($langcode) {
drupal_goto('admin/build/locale/language/overview');
}
$default = language_default();
if ($default->language == $langcode) {
drupal_set_message(t('The default language cannot be deleted.'));
drupal_goto('admin/build/locale/language/overview');
}
// For other locales, warn user that data loss is ahead.
$languages = language_list();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment