system.module 132 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.theme')->get('admin') ?: 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 496 497 498 499 500
    // Forms that show author fields to both anonymous and authenticated users
    // need to dynamically switch between #type 'textfield' and #type 'item' to
    // automatically take over the authenticated user's information. Therefore,
    // we allow #type 'item' to receive input, which is internally assigned by
    // Form API based on the #default_value or #value properties.
    '#input' => TRUE,
501
    '#markup' => '',
502
    '#theme_wrappers' => array('form_element'),
503
  );
504
  $types['hidden'] = array(
505
    '#input' => TRUE,
506
    '#process' => array('ajax_process_form'),
507
    '#theme' => 'hidden',
508
  );
509
  $types['value'] = array(
510 511
    '#input' => TRUE,
  );
512
  $types['markup'] = array(
513
    '#markup' => '',
514 515
  );
  $types['link'] = array(
516
    '#pre_render' => array('drupal_pre_render_link'),
517
  );
518
  $types['fieldset'] = array(
519 520 521 522 523
    '#value' => NULL,
    '#process' => array('ajax_process_form'),
    '#theme_wrappers' => array('fieldset'),
  );
  $types['details'] = array(
524 525 526
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
    '#value' => NULL,
527 528 529
    '#process' => array('form_process_details', 'ajax_process_form'),
    '#pre_render' => array('form_pre_render_details'),
    '#theme_wrappers' => array('details'),
530
  );
531
  $types['vertical_tabs'] = array(
532
    '#theme_wrappers' => array('vertical_tabs'),
533 534 535
    '#default_tab' => '',
    '#process' => array('form_process_vertical_tabs'),
  );
536 537 538 539 540 541 542 543
  $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'),
  );
544 545 546 547 548

  $types['container'] = array(
    '#theme_wrappers' => array('container'),
    '#process' => array('form_process_container'),
  );
549 550 551 552 553
  $types['actions'] = array(
    '#theme_wrappers' => array('container'),
    '#process' => array('form_process_actions', 'form_process_container'),
    '#weight' => 100,
  );
554

555
  $types['token'] = array(
556
    '#input' => TRUE,
557
    '#theme' => 'hidden',
558 559
  );

560
  return $types;
561 562
}

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

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

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

702
  // Modules.
703
  $items['admin/modules'] = array(
704 705
    'title' => 'Extend',
    'description' => 'Add and enable modules to extend site functionality.',
706 707
    'page callback' => 'drupal_get_form',
    'page arguments' => array('system_modules'),
708
    'access arguments' => array('administer modules'),
709
    'file' => 'system.admin.inc',
710
    'weight' => -2,
711
  );
712
  $items['admin/modules/list'] = array(
713
    'title' => 'List',
714 715
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
716
  $items['admin/modules/list/confirm'] = array(
717
    'title' => 'List',
718
    'access arguments' => array('administer modules'),
719
    'type' => MENU_VISIBLE_IN_BREADCRUMB,