system.module 131 KB
Newer Older
Dries's avatar
   
Dries committed
1
2
<?php

Dries's avatar
   
Dries committed
3
4
5
6
7
/**
 * @file
 * Configuration system that lets administrators modify the workings of the site.
 */

8
use Drupal\Core\Utility\ModuleInfo;
9
use Drupal\Core\TypedData\Primitive;
10

11
use Symfony\Component\HttpFoundation\JsonResponse;
12
13
use Symfony\Component\HttpFoundation\Response;

14
15
16
/**
 * Maximum age of temporary files in seconds.
 */
17
const DRUPAL_MAXIMUM_TEMP_FILE_AGE = 21600;
18

19
20
21
/**
 * New users will be set to the default time zone at registration.
 */
22
const DRUPAL_USER_TIMEZONE_DEFAULT = 0;
23
24
25
26

/**
 * New users will get an empty time zone at registration.
 */
27
const DRUPAL_USER_TIMEZONE_EMPTY = 1;
28
29
30
31

/**
 * New users will select their own timezone at registration.
 */
32
const DRUPAL_USER_TIMEZONE_SELECT = 2;
33

34
35
36
 /**
 * Disabled option on forms and settings
 */
37
const DRUPAL_DISABLED = 0;
38
39
40
41

/**
 * Optional option on forms and settings
 */
42
const DRUPAL_OPTIONAL = 1;
43
44
45
46

/**
 * Required option on forms and settings
 */
47
const DRUPAL_REQUIRED = 2;
48

49
/**
50
 * Return only visible regions.
51
52
 *
 * @see system_region_list()
53
 */
54
const REGIONS_VISIBLE = 'visible';
55
56

/**
57
 * Return all regions.
58
59
 *
 * @see system_region_list()
60
 */
61
const REGIONS_ALL = 'all';
62

Dries's avatar
   
Dries committed
63
/**
64
 * Implements hook_help().
Dries's avatar
   
Dries committed
65
 */
66
function system_help($path, $arg) {
67
68
  global $base_url;

69
  switch ($path) {
70
    case 'admin/help#system':
71
72
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
73
      $output .= '<p>' . t('The System module is integral to the site, and provides basic but extensible functionality for use by other modules and themes. Some integral elements of Drupal are contained in and managed by the System module, including caching, enabling and disabling modules and themes, preparing and displaying the administrative page, and configuring fundamental site settings. A number of key system maintenance operations are also part of the System module. For more information, see the online handbook entry for <a href="@system">System module</a>.', array('@system' => 'http://drupal.org/documentation/modules/system')) . '</p>';
74
75
76
      $output .= '<h3>' . t('Uses') . '</h3>';
      $output .= '<dl>';
      $output .= '<dt>' . t('Managing modules') . '</dt>';
77
      $output .= '<dd>' . t('The System module allows users with the appropriate permissions to enable and disable modules on the <a href="@modules">Modules administration page</a>. Drupal comes with a number of core modules, and each module provides a discrete set of features and may be enabled or disabled depending on the needs of the site. Many additional modules contributed by members of the Drupal community are available for download at the <a href="@drupal-modules">Drupal.org module page</a>.', array('@modules' => url('admin/modules'), '@drupal-modules' => 'http://drupal.org/project/modules')) . '</dd>';
78
79
80
81
82
      $output .= '<dt>' . t('Managing themes') . '</dt>';
      $output .= '<dd>' . t('The System module allows users with the appropriate permissions to enable and disable themes on the <a href="@themes">Appearance administration page</a>. Themes determine the design and presentation of your site. Drupal comes packaged with several core themes, and additional contributed themes are available at the <a href="@drupal-themes">Drupal.org theme page</a>.', array('@themes' => url('admin/appearance'), '@drupal-themes' => 'http://drupal.org/project/themes')) . '</dd>';
      $output .= '<dt>' . t('Managing caching') . '</dt>';
      $output .= '<dd>' . t("The System module allows users with the appropriate permissions to manage caching on the <a href='@cache-settings'>Performance settings page</a>. Drupal has a robust caching system that allows the efficient re-use of previously-constructed web pages and web page components. Pages requested by anonymous users are stored in a compressed format; depending on your site configuration and the amount of your web traffic tied to anonymous visitors, the caching system may significantly increase the speed of your site.", array('@cache-settings' => url('admin/config/development/performance'))) . '</dd>';
      $output .= '<dt>' . t('Performing system maintenance') . '</dt>';
83
      $output .= '<dd>' . t('In order for the site and its modules to continue to operate well, a set of routine administrative operations must run on a regular basis. The System module manages this task by making use of a system cron job. You can verify the status of cron tasks by visiting the <a href="@status">Status report page</a>. For more information, see the online handbook entry for <a href="@handbook">configuring cron jobs</a>. You can set up cron job by visiting <a href="@cron">Cron configuration</a> page', array('@status' => url('admin/reports/status'), '@handbook' => 'http://drupal.org/cron', '@cron' => url('admin/config/system/cron'))) . '</dd>';
84
      $output .= '<dt>' . t('Configuring basic site settings') . '</dt>';
85
      $output .= '<dd>' . t('The System module also handles basic configuration options for your site, including <a href="@date-time-settings">Date and time settings</a>, <a href="@file-system">File system settings</a>, <a href="@site-info">Site name and other information</a>, and a <a href="@maintenance-mode">Maintenance mode</a> for taking your site temporarily offline.', array('@date-time-settings' => url('admin/config/regional/date-time'), '@file-system' => url('admin/config/media/file-system'), '@site-info' => url('admin/config/system/site-information'), '@maintenance-mode' => url('admin/config/development/maintenance'))) . '</dd>';
86
      $output .= '</dl>';
87
      return $output;
88
    case 'admin/index':
89
      return '<p>' . t('This page shows you all available administration tasks for each module.') . '</p>';
90
    case 'admin/appearance':
91
      $output = '<p>' . t('Set and configure the default theme for your website.  Alternative <a href="@themes">themes</a> are available.', array('@themes' => 'http://drupal.org/project/themes')) . '</p>';
92
      return $output;
93
    case 'admin/appearance/settings/' . $arg[3]:
94
95
96
      $theme_list = list_themes();
      $theme = $theme_list[$arg[3]];
      return '<p>' . t('These options control the display settings for the %name theme. When your site is displayed using this theme, these settings will be used.', array('%name' => $theme->info['name'])) . '</p>';
97
    case 'admin/appearance/settings':
98
      return '<p>' . t('These options control the default display settings for your entire site, across all themes. Unless they have been overridden by a specific theme, these settings will be used.') . '</p>';
99
    case 'admin/modules':
100
      $output = '<p>' . t('Download additional <a href="@modules">contributed modules</a> to extend Drupal\'s functionality.', array('@modules' => 'http://drupal.org/project/modules')) . '</p>';
101
102
      if (module_exists('update')) {
        if (update_manager_access()) {
103
          $output .= '<p>' . t('Regularly review and install <a href="@updates">available updates</a> to maintain a secure and current site. Always run the <a href="@update-php">update script</a> each time a module is updated.', array('@update-php' => $base_url . '/core/update.php', '@updates' => url('admin/reports/updates'))) . '</p>';
104
105
        }
        else {
106
          $output .= '<p>' . t('Regularly review <a href="@updates">available updates</a> to maintain a secure and current site. Always run the <a href="@update-php">update script</a> each time a module is updated.', array('@update-php' => $base_url . '/core/update.php', '@updates' => url('admin/reports/updates'))) . '</p>';
107
108
109
        }
      }
      else {
110
        $output .= '<p>' . t('Regularly review available updates to maintain a secure and current site. Always run the <a href="@update-php">update script</a> each time a module is updated. Enable the Update Manager module to update and install modules and themes.', array('@update-php' => $base_url . '/core/update.php')) . '</p>';
111
      }
112
      return $output;
113
    case 'admin/modules/uninstall':
114
      return '<p>' . t('The uninstall process removes all data related to a module. To uninstall a module, you must first disable it on the main <a href="@modules">Modules page</a>.', array('@modules' => url('admin/modules'))) . '</p>';
115
    case 'admin/structure/block/manage':
116
      if ($arg[4] == 'system' && $arg[5] == 'powered-by') {
117
        return '<p>' . t('The <em>Powered by Drupal</em> block is an optional link to the home page of the Drupal project. While there is absolutely no requirement that sites feature this link, it may be used to show support for Drupal.') . '</p>';
118
      }
119
      break;
120
    case 'admin/config/development/maintenance':
121
122
      global $user;
      if ($user->uid == 1) {
123
        return '<p>' . t('Use maintenance mode when making major updates, particularly if the updates could disrupt visitors or the update process. Examples include upgrading, importing or exporting content, modifying a theme, modifying content types, and making backups.') . '</p>';
124
      }
125
      break;
126
    case 'admin/reports/status':
127
      return '<p>' . t("Here you can find a short overview of your site's parameters as well as any problems detected with your installation. It may be useful to copy and paste this information into support requests filed on drupal.org's support forums and project issue queues. Before filing a support request, ensure that your web server meets the <a href=\"@system-requirements\">system requirements.</a>", array('@system-requirements' => 'http://drupal.org/requirements')) . '</p>';
128
  }
Dries's avatar
   
Dries committed
129
130
}

131
/**
132
 * Implements hook_theme().
133
 */
134
function system_theme() {
135
  return array_merge(drupal_common_theme(), array(
136
137
    'system_themes_page' => array(
      'variables' => array('theme_groups' => NULL),
138
      'file' => 'system.admin.inc',
139
    ),
140
    'system_settings_form' => array(
141
      'render element' => 'form',
142
143
    ),
    'confirm_form' => array(
144
      'render element' => 'form',
145
    ),
146
    'system_modules_details' => array(
147
      'render element' => 'form',
148
      'file' => 'system.admin.inc',
149
    ),
150
    'system_modules_incompatible' => array(
151
      'variables' => array('message' => NULL),
152
      'file' => 'system.admin.inc',
153
    ),
154
    'system_modules_uninstall' => array(
155
      'render element' => 'form',
156
      'file' => 'system.admin.inc',
157
158
    ),
    'status_report' => array(
159
      'render element' => 'requirements',
160
      'file' => 'system.admin.inc',
161
162
    ),
    'admin_page' => array(
163
      'variables' => array('blocks' => NULL),
164
      'file' => 'system.admin.inc',
165
166
    ),
    'admin_block' => array(
167
      'variables' => array('block' => NULL),
168
      'file' => 'system.admin.inc',
169
170
    ),
    'admin_block_content' => array(
171
      'variables' => array('content' => NULL),
172
      'file' => 'system.admin.inc',
173
    ),
174
    'system_admin_index' => array(
175
      'variables' => array('menu_items' => NULL),
176
      'file' => 'system.admin.inc',
177
    ),
178
    'system_powered_by' => array(
179
      'variables' => array(),
180
    ),
181
182
    'system_compact_link' => array(
      'variables' => array(),
183
    ),
184
185
186
    'system_date_format_localize_form' => array(
      'render element' => 'form',
    ),
187
188
  ));
}
189

Dries's avatar
   
Dries committed
190
/**
191
 * Implements hook_permission().
Dries's avatar
   
Dries committed
192
 */
193
function system_permission() {
194
  return array(
195
196
197
    'administer modules' => array(
      'title' => t('Administer modules'),
    ),
198
199
    'administer site configuration' => array(
      'title' => t('Administer site configuration'),
200
      'restrict access' => TRUE,
201
    ),
202
203
204
    'administer themes' => array(
      'title' => t('Administer themes'),
    ),
205
    'administer software updates' => array(
206
207
      'title' => t('Administer software updates'),
      'restrict access' => TRUE,
208
    ),
209
    'access administration pages' => array(
210
      'title' => t('Use the administration pages and help'),
211
    ),
212
    'access site in maintenance mode' => array(
213
      'title' => t('Use the site in maintenance mode'),
214
    ),
215
216
    'view the administration theme' => array(
      'title' => t('View the administration theme'),
217
      'description' => config('system.site')->get('admin_theme') ?: t('This is only used when the site is configured to use a separate administration theme on the <a href="@appearance-url">Appearance</a> page.', array('@appearance-url' => url('admin/appearance'))),
218
    ),
219
    'access site reports' => array(
220
      'title' => t('View site reports'),
221
    ),
222
  );
Dries's avatar
   
Dries committed
223
224
}

225
/**
226
 * Implements hook_hook_info().
227
228
229
230
231
 */
function system_hook_info() {
  $hooks['token_info'] = array(
    'group' => 'tokens',
  );
232
233
234
  $hooks['token_info_alter'] = array(
    'group' => 'tokens',
  );
235
236
237
  $hooks['tokens'] = array(
    'group' => 'tokens',
  );
238
239
240
241
  $hooks['tokens_alter'] = array(
    'group' => 'tokens',
  );

242
243
244
  return $hooks;
}

245
/**
246
 * Implements hook_element_info().
247
 */
248
249
250
function system_element_info() {
  // Top level elements.
  $types['form'] = array(
251
252
    '#method' => 'post',
    '#action' => request_uri(),
253
    '#theme_wrappers' => array('form'),
254
  );
255
  $types['page'] = array(
256
257
    '#show_messages' => TRUE,
    '#theme' => 'page',
258
    '#theme_wrappers' => array('html'),
259
  );
260
  // By default, we don't want Ajax commands being rendered in the context of an
261
262
  // HTML page, so we don't provide defaults for #theme or #theme_wrappers.
  // However, modules can set these properties (for example, to provide an HTML
263
  // debugging page that displays rather than executes Ajax commands).
264
265
266
267
  $types['ajax'] = array(
    '#header' => TRUE,
    '#commands' => array(),
    '#error' => NULL,
268
  );
269
270
  $types['html_tag'] = array(
    '#theme' => 'html_tag',
271
    '#pre_render' => array('drupal_pre_render_conditional_comments'),
272
273
274
    '#attributes' => array(),
    '#value' => NULL,
  );
275
276
277
278
279
280
  $types['styles'] = array(
    '#items' => array(),
    '#pre_render' => array('drupal_pre_render_styles'),
    '#group_callback' => 'drupal_group_css',
    '#aggregate_callback' => 'drupal_aggregate_css',
  );
281
282
283
284
285
286
  $types['scripts'] = array(
    '#items' => array(),
    '#pre_render' => array('drupal_pre_render_scripts'),
    '#group_callback' => 'drupal_group_js',
    '#aggregate_callback' => 'drupal_aggregate_js',
  );
287

288
289
  // Input elements.
  $types['submit'] = array(
290
291
    '#input' => TRUE,
    '#name' => 'op',
292
    '#is_button' => TRUE,
293
    '#executes_submit_callback' => TRUE,
294
    '#limit_validation_errors' => FALSE,
295
    '#process' => array('form_process_button', 'ajax_process_form'),
296
    '#theme_wrappers' => array('button'),
297
  );
298
  $types['button'] = array(
299
300
    '#input' => TRUE,
    '#name' => 'op',
301
    '#is_button' => TRUE,
302
    '#executes_submit_callback' => FALSE,
303
    '#limit_validation_errors' => FALSE,
304
    '#process' => array('form_process_button', 'ajax_process_form'),
305
    '#theme_wrappers' => array('button'),
306
  );
307
  $types['image_button'] = array(
308
    '#input' => TRUE,
309
    '#is_button' => TRUE,
310
    '#executes_submit_callback' => TRUE,
311
    '#limit_validation_errors' => FALSE,
312
    '#process' => array('form_process_button', 'ajax_process_form'),
313
314
315
    '#return_value' => TRUE,
    '#has_garbage_value' => TRUE,
    '#src' => NULL,
316
    '#theme_wrappers' => array('image_button'),
317
  );
318
  $types['textfield'] = array(
319
320
321
322
    '#input' => TRUE,
    '#size' => 60,
    '#maxlength' => 128,
    '#autocomplete_path' => FALSE,
323
    '#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern'),
324
    '#theme' => 'textfield',
325
    '#theme_wrappers' => array('form_element'),
326
  );
327
328
329
330
331
  $types['tel'] = array(
    '#input' => TRUE,
    '#size' => 30,
    '#maxlength' => 128,
    '#autocomplete_path' => FALSE,
332
    '#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern'),
333
334
335
    '#theme' => 'tel',
    '#theme_wrappers' => array('form_element'),
  );
336
337
338
  $types['email'] = array(
    '#input' => TRUE,
    '#size' => 60,
339
340
    // user.module is not loaded in case of early bootstrap errors.
    '#maxlength' => defined('EMAIL_MAX_LENGTH') ? EMAIL_MAX_LENGTH : 255,
341
    '#autocomplete_path' => FALSE,
342
    '#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern'),
343
344
345
346
    '#element_validate' => array('form_validate_email'),
    '#theme' => 'email',
    '#theme_wrappers' => array('form_element'),
  );
347
348
349
350
351
  $types['url'] = array(
    '#input' => TRUE,
    '#size' => 60,
    '#maxlength' => 255,
    '#autocomplete_path' => FALSE,
352
    '#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern'),
353
354
355
356
    '#element_validate' => array('form_validate_url'),
    '#theme' => 'url',
    '#theme_wrappers' => array('form_element'),
  );
357
358
359
360
361
  $types['search'] = array(
    '#input' => TRUE,
    '#size' => 60,
    '#maxlength' => 128,
    '#autocomplete_path' => FALSE,
362
    '#process' => array('form_process_autocomplete', 'ajax_process_form'),
363
364
365
    '#theme' => 'search',
    '#theme_wrappers' => array('form_element'),
  );
366
367
368
369
370
371
372
373
  $types['number'] = array(
    '#input' => TRUE,
    '#step' => 1,
    '#process' => array('ajax_process_form'),
    '#element_validate' => array('form_validate_number'),
    '#theme' => 'number',
    '#theme_wrappers' => array('form_element'),
  );
374
375
376
377
378
379
380
381
382
383
  $types['range'] = array(
    '#input' => TRUE,
    '#step' => 1,
    '#min' => 0,
    '#max' => 100,
    '#process' => array('ajax_process_form'),
    '#element_validate' => array('form_validate_number'),
    '#theme' => 'range',
    '#theme_wrappers' => array('form_element'),
  );
384
385
386
387
388
389
390
  $types['color'] = array(
    '#input' => TRUE,
    '#process' => array('ajax_process_form'),
    '#element_validate' => array('form_validate_color'),
    '#theme' => 'color',
    '#theme_wrappers' => array('form_element'),
  );
391
392
393
394
395
396
397
  $types['machine_name'] = array(
    '#input' => TRUE,
    '#default_value' => NULL,
    '#required' => TRUE,
    '#maxlength' => 64,
    '#size' => 60,
    '#autocomplete_path' => FALSE,
398
    '#process' => array('form_process_machine_name', 'form_process_autocomplete', 'ajax_process_form'),
399
400
401
402
    '#element_validate' => array('form_validate_machine_name'),
    '#theme' => 'textfield',
    '#theme_wrappers' => array('form_element'),
  );
403
  $types['password'] = array(
404
405
406
    '#input' => TRUE,
    '#size' => 60,
    '#maxlength' => 128,
407
    '#process' => array('ajax_process_form', 'form_process_pattern'),
408
    '#theme' => 'password',
409
    '#theme_wrappers' => array('form_element'),
410
  );
411
  $types['password_confirm'] = array(
412
    '#input' => TRUE,
413
    '#process' => array('form_process_password_confirm', 'user_form_process_password_confirm'),
414
    '#theme_wrappers' => array('form_element'),
415
  );
416
  $types['textarea'] = array(
417
418
419
    '#input' => TRUE,
    '#cols' => 60,
    '#rows' => 5,
420
    '#resizable' => 'vertical',
421
    '#process' => array('ajax_process_form'),
422
    '#theme' => 'textarea',
423
    '#theme_wrappers' => array('form_element'),
424
  );
425
  $types['radios'] = array(
426
    '#input' => TRUE,
427
    '#process' => array('form_process_radios'),
428
    '#theme_wrappers' => array('radios'),
429
    '#pre_render' => array('form_pre_render_conditional_form_element'),
430
  );
431
  $types['radio'] = array(
432
433
    '#input' => TRUE,
    '#default_value' => NULL,
434
    '#process' => array('ajax_process_form'),
435
    '#theme' => 'radio',
436
    '#theme_wrappers' => array('form_element'),
437
    '#title_display' => 'after',
438
  );
439
  $types['checkboxes'] = array(
440
    '#input' => TRUE,
441
    '#process' => array('form_process_checkboxes'),
442
    '#theme_wrappers' => array('checkboxes'),
443
    '#pre_render' => array('form_pre_render_conditional_form_element'),
444
  );
445
  $types['checkbox'] = array(
446
447
    '#input' => TRUE,
    '#return_value' => 1,
448
    '#theme' => 'checkbox',
449
    '#process' => array('form_process_checkbox', 'ajax_process_form'),
450
    '#theme_wrappers' => array('form_element'),
451
    '#title_display' => 'after',
452
  );
453
  $types['select'] = array(
454
455
    '#input' => TRUE,
    '#multiple' => FALSE,
456
    '#process' => array('form_process_select', 'ajax_process_form'),
457
    '#theme' => 'select',
458
    '#theme_wrappers' => array('form_element'),
459
  );
460
461
462
463
  $types['language_select'] = array(
    '#input' => TRUE,
    '#default_value' => LANGUAGE_NOT_SPECIFIED,
  );
464
  $types['weight'] = array(
465
466
467
    '#input' => TRUE,
    '#delta' => 10,
    '#default_value' => 0,
468
    '#process' => array('form_process_weight', 'ajax_process_form'),
469
  );
470
  $types['date'] = array(
471
472
    '#input' => TRUE,
    '#element_validate' => array('date_validate'),
473
    '#process' => array('form_process_date'),
474
    '#theme' => 'date',
475
    '#theme_wrappers' => array('form_element'),
476
  );
477
  $types['file'] = array(
478
479
    '#input' => TRUE,
    '#size' => 60,
480
    '#theme' => 'file',
481
    '#theme_wrappers' => array('form_element'),
482
  );
483
  $types['tableselect'] = array(
484
485
486
487
488
489
    '#input' => TRUE,
    '#js_select' => TRUE,
    '#multiple' => TRUE,
    '#process' => array('form_process_tableselect'),
    '#options' => array(),
    '#empty' => '',
490
    '#theme' => 'tableselect',
491
  );
492

493
494
  // Form structure.
  $types['item'] = array(
495
    '#markup' => '',
496
    '#theme_wrappers' => array('form_element'),
497
  );
498
  $types['hidden'] = array(
499
    '#input' => TRUE,
500
    '#process' => array('ajax_process_form'),
501
    '#theme' => 'hidden',
502
  );
503
  $types['value'] = array(
504
505
    '#input' => TRUE,
  );
506
  $types['markup'] = array(
507
    '#markup' => '',
508
509
  );
  $types['link'] = array(
510
    '#pre_render' => array('drupal_pre_render_link'),
511
  );
512
  $types['fieldset'] = array(
513
514
515
516
517
    '#value' => NULL,
    '#process' => array('ajax_process_form'),
    '#theme_wrappers' => array('fieldset'),
  );
  $types['details'] = array(
518
519
520
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
    '#value' => NULL,
521
522
523
    '#process' => array('form_process_details', 'ajax_process_form'),
    '#pre_render' => array('form_pre_render_details'),
    '#theme_wrappers' => array('details'),
524
  );
525
  $types['vertical_tabs'] = array(
526
    '#theme_wrappers' => array('vertical_tabs'),
527
528
529
    '#default_tab' => '',
    '#process' => array('form_process_vertical_tabs'),
  );
530
531
532
533
534
535
536
537
  $types['dropbutton'] = array(
    '#theme' => 'links__dropbutton',
    '#pre_render' => array('drupal_pre_render_dropbutton'),
  );
  $types['operations'] = array(
    '#theme' => 'links__dropbutton__operations',
    '#pre_render' => array('drupal_pre_render_dropbutton'),
  );
538
539
540
541
542

  $types['container'] = array(
    '#theme_wrappers' => array('container'),
    '#process' => array('form_process_container'),
  );
543
544
545
546
547
  $types['actions'] = array(
    '#theme_wrappers' => array('container'),
    '#process' => array('form_process_actions', 'form_process_container'),
    '#weight' => 100,
  );
548

549
  $types['token'] = array(
550
    '#input' => TRUE,
551
    '#theme' => 'hidden',
552
553
  );

554
  return $types;
555
556
}

Dries's avatar
   
Dries committed
557
/**
558
 * Implements hook_menu().
Dries's avatar
   
Dries committed
559
 */
560
561
function system_menu() {
  $items['system/files'] = array(
562
    'title' => 'File download',
563
    'page callback' => 'file_download',
564
565
566
567
568
569
570
571
    'page arguments' => array('private'),
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );
  $items['system/temporary'] = array(
    'title' => 'Temporary files',
    'page callback' => 'file_download',
    'page arguments' => array('temporary'),
572
    'access callback' => TRUE,
573
574
    'type' => MENU_CALLBACK,
  );
575
  $items['system/ajax'] = array(
576
    'title' => 'AHAH callback',
577
    'page callback' => 'ajax_form_callback',
578
    'access callback' => TRUE,
579
    'theme callback' => 'ajax_base_page_theme',
580
    'type' => MENU_CALLBACK,
581
    'file path' => 'core/includes',
582
    'file' => 'form.inc',
583
  );
584
585
586
587
588
  $items['system/timezone'] = array(
    'title' => 'Time zone',
    'page callback' => 'system_timezone',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
589
    'file' => 'system.admin.inc',
590
  );
591
  $items['admin'] = array(
592
    'title' => 'Administration',
593
    'access arguments' => array('access administration pages'),
594
    'page callback' => 'system_admin_menu_block_page',
595
    'weight' => 9,
596
    'menu_name' => 'admin',
597
    'file' => 'system.admin.inc',
598
599
  );
  $items['admin/compact'] = array(
600
    'title' => 'Compact mode',
601
    'page callback' => 'system_admin_compact_page',
602
    'access arguments' => array('access administration pages'),
603
    'type' => MENU_CALLBACK,
604
    'file' => 'system.admin.inc',
605
  );
606
607
  $items['admin/tasks'] = array(
    'title' => 'Tasks',
608
    'type' => MENU_DEFAULT_LOCAL_TASK,
609
    'weight' => -20,
610
  );
611
612
613
  $items['admin/index'] = array(
    'title' => 'Index',
    'page callback' => 'system_admin_index',
614
    'access arguments' => array('access administration pages'),
615
    'type' => MENU_LOCAL_TASK,
616
    'weight' => -18,
617
    'file' => 'system.admin.inc',
618
  );
619

620
  // Menu items that are basically just menu blocks.
621
622
  $items['admin/structure'] = array(
    'title' => 'Structure',
623
    'description' => 'Administer blocks, content types, menus, etc.',
624
    'position' => 'right',
625
    'weight' => -8,
626
    'page callback' => 'system_admin_menu_block_page',
627
    'access arguments' => array('access administration pages'),
628
    'file' => 'system.admin.inc',
629
  );
630
631
632
  // Appearance.
  $items['admin/appearance'] = array(
    'title' => 'Appearance',
633
    'description' => 'Select and configure your themes.',
634
    'page callback' => 'system_themes_page',
635
    'access arguments' => array('administer themes'),
636
    'position' => 'left',
637
    'weight' => -6,
638
    'file' => 'system.admin.inc',
639
  );
640
  $items['admin/appearance/list'] = array(
641
    'title' => 'List',
642
    'description' => 'Select and configure your theme',
643
644
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -1,
645
    'file' => 'system.admin.inc',
646
  );
647
648
649
  $items['admin/appearance/enable'] = array(
    'title' => 'Enable theme',
    'page callback' => 'system_theme_enable',
650
    'access arguments' => array('administer themes'),
651
652
653
654
655
656
    'type' => MENU_CALLBACK,
    'file' => 'system.admin.inc',
  );
  $items['admin/appearance/disable'] = array(
    'title' => 'Disable theme',
    'page callback' => 'system_theme_disable',
657
    'access arguments' => array('administer themes'),
658
659
660
661
662
663
    'type' => MENU_CALLBACK,
    'file' => 'system.admin.inc',
  );
  $items['admin/appearance/default'] = array(
    'title' => 'Set default theme',
    'page callback' => 'system_theme_default',
664
    'access arguments' => array('administer themes'),
665
666
667
    'type' => MENU_CALLBACK,
    'file' => 'system.admin.inc',
  );
668
  $items['admin/appearance/settings'] = array(
669
    'title' => 'Settings',
670
    'description' => 'Configure default and theme specific settings.',
671
    'page callback' => 'drupal_get_form',
672
    'page arguments' => array('system_theme_settings'),
673
    'access arguments' => array('administer themes'),
674
    'type' => MENU_LOCAL_TASK,
675
    'file' => 'system.admin.inc',
676
    'weight' => 20,
677
  );
678
  // Theme configuration subtabs.
679
  $items['admin/appearance/settings/global'] = array(
680
    'title' => 'Global settings',
681
682
683
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -1,
  );
Dries's avatar
   
Dries committed
684

685
  foreach (list_themes() as $key => $theme) {
686
    $items['admin/appearance/settings/' . $theme->name] = array(
687
688
689
690
      'title' => $theme->info['name'],
      'page arguments' => array('system_theme_settings', $theme->name),
      'type' => MENU_LOCAL_TASK,
      'access callback' => '_system_themes_access',
691
      'access arguments' => array($key),
692
      'file' => 'system.admin.inc',
693
    );
Dries's avatar
   
Dries committed
694
  }
drumm's avatar
drumm committed
695

696
  // Modules.
697
  $items['admin/modules'] = array(
698
699
    'title' => 'Extend',
    'description' => 'Add and enable modules to extend site functionality.',
700
701
    'page callback' => 'drupal_get_form',
    'page arguments' => array('system_modules'),
702
    'access arguments' => array('administer modules'),
703
    'file' => 'system.admin.inc',
704
    'weight' => -2,
705
  );
706
  $items['admin/modules/list'] = array(
707
    'title' => 'List',
708
709
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
710
  $items['admin/modules/list/confirm'] = array(
711
    'title' => 'List',
712
    'access arguments' => array('administer modules'),
713
    'type' => MENU_VISIBLE_IN_BREADCRUMB,
714
  );
715
  $items['admin/modules/uninstall'] = array(
716
    'title' => 'Uninstall',
717
    'page arguments' => array('system_modules_uninstall'),
718
    'access arguments' => array('administer modules'),
719
    'type' => MENU_LOCAL_TASK,
720
    'file' => 'system.admin.inc',
721
    'weight' => 20,
722
  );
723
  $items['admin/modules/uninstall/confirm'] = array(
724
    'title' => 'Uninstall',
725
    'access arguments' => array('administer modules'),
726
    'type' => MENU_VISIBLE_IN_BREADCRUMB,
727
728
729
    'file' => 'system.admin.inc',
  );

730
  // Configuration.
731
732
  $items['admin/config'] = array(
    'title' => 'Configuration',
733
    'description' => 'Administer settings.',
734
735
    'page callback' => 'system_admin_config_page',
    'access arguments' => array('access administration pages'),
736
    'file' => 'system.admin.inc',
737
738
  );

739
  // Media settings.
740
  $items['admin/config/media'] = array(
741
742
743
    'title' => 'Media',
    'description' => 'Media tools.',
    'position' => 'left',
744
    'weight' => -10,
745
    'page callback' => 'system_admin_menu_block_page',
746
    'access arguments' => array('access administration pages'),
747
    'file' => 'system.admin.inc',
748
749
  );
  $items['admin/config/media/file-system'] = array(
750
    'title' => 'File system',
751
    'description' => 'Tell Drupal where to store uploaded files and how they are accessed.',
752
    'page callback' => 'drupal_get_form',
753