system.module 144 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 51 52 53 54 55
/**
 * Maximum number of values in a weight select element.
 *
 * If the number of values is over the maximum, a text field is used instead.
 */
const DRUPAL_WEIGHT_SELECT_MAX = 100;

56
/**
57
 * Return only visible regions.
58 59
 *
 * @see system_region_list()
60
 */
61
const REGIONS_VISIBLE = 'visible';
62 63

/**
64
 * Return all regions.
65 66
 *
 * @see system_region_list()
67
 */
68
const REGIONS_ALL = 'all';
69

Dries's avatar
 
Dries committed
70
/**
71
 * Implements hook_help().
Dries's avatar
 
Dries committed
72
 */
73
function system_help($path, $arg) {
74 75
  global $base_url;

76
  switch ($path) {
77
    case 'admin/help#system':
78 79
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
80
      $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>';
81 82 83
      $output .= '<h3>' . t('Uses') . '</h3>';
      $output .= '<dl>';
      $output .= '<dt>' . t('Managing modules') . '</dt>';
84
      $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>';
85 86 87 88 89
      $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>';
90
      $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>';
91
      $output .= '<dt>' . t('Configuring basic site settings') . '</dt>';
92
      $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>';
93
      $output .= '</dl>';
94
      return $output;
95
    case 'admin/index':
96
      return '<p>' . t('This page shows you all available administration tasks for each module.') . '</p>';
97
    case 'admin/appearance':
98
      $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>';
99
      return $output;
100
    case 'admin/appearance/settings/' . $arg[3]:
101 102 103
      $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>';
104
    case 'admin/appearance/settings':
105
      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>';
106
    case 'admin/modules':
107
      $output = '<p>' . t('Download additional <a href="@modules">contributed modules</a> to extend Drupal\'s functionality.', array('@modules' => 'http://drupal.org/project/modules')) . '</p>';
108 109
      if (module_exists('update')) {
        if (update_manager_access()) {
110
          $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>';
111 112
        }
        else {
113
          $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>';
114 115 116
        }
      }
      else {
117
        $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>';
118
      }
119
      return $output;
120
    case 'admin/modules/uninstall':
121
      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>';
122
    case 'admin/structure/block/manage':
123
      if ($arg[4] == 'system' && $arg[5] == 'powered-by') {
124
        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>';
125
      }
126
      break;
127
    case 'admin/config/development/maintenance':
128 129
      global $user;
      if ($user->uid == 1) {
130
        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>';
131
      }
132
      break;
133
    case 'admin/reports/status':
134
      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>';
135
  }
Dries's avatar
 
Dries committed
136 137
}

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

Dries's avatar
 
Dries committed
201
/**
202
 * Implements hook_permission().
Dries's avatar
 
Dries committed
203
 */
204
function system_permission() {
205
  return array(
206 207 208
    'administer modules' => array(
      'title' => t('Administer modules'),
    ),
209 210
    'administer site configuration' => array(
      'title' => t('Administer site configuration'),
211
      'restrict access' => TRUE,
212
    ),
213 214 215
    'administer themes' => array(
      'title' => t('Administer themes'),
    ),
216
    'administer software updates' => array(
217 218
      'title' => t('Administer software updates'),
      'restrict access' => TRUE,
219
    ),
220
    'access administration pages' => array(
221
      'title' => t('Use the administration pages and help'),
222
    ),
223
    'access site in maintenance mode' => array(
224
      'title' => t('Use the site in maintenance mode'),
225
    ),
226 227 228 229
    'view the administration theme' => array(
      'title' => t('View the administration theme'),
      'description' => variable_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'))),
    ),
230
    'access site reports' => array(
231
      'title' => t('View site reports'),
232
    ),
233
  );
Dries's avatar
 
Dries committed
234 235
}

236
/**
237
 * Implements hook_hook_info().
238 239 240 241 242
 */
function system_hook_info() {
  $hooks['token_info'] = array(
    'group' => 'tokens',
  );
243 244 245
  $hooks['token_info_alter'] = array(
    'group' => 'tokens',
  );
246 247 248
  $hooks['tokens'] = array(
    'group' => 'tokens',
  );
249 250 251 252
  $hooks['tokens_alter'] = array(
    'group' => 'tokens',
  );

253 254 255
  return $hooks;
}

256
/**
257
 * Implements hook_element_info().
258
 */
259 260 261
function system_element_info() {
  // Top level elements.
  $types['form'] = array(
262 263
    '#method' => 'post',
    '#action' => request_uri(),
264
    '#theme_wrappers' => array('form'),
265
  );
266
  $types['page'] = array(
267 268
    '#show_messages' => TRUE,
    '#theme' => 'page',
269
    '#theme_wrappers' => array('html'),
270
  );
271
  // By default, we don't want Ajax commands being rendered in the context of an
272 273
  // 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
274
  // debugging page that displays rather than executes Ajax commands).
275 276 277 278
  $types['ajax'] = array(
    '#header' => TRUE,
    '#commands' => array(),
    '#error' => NULL,
279
  );
280 281
  $types['html_tag'] = array(
    '#theme' => 'html_tag',
282
    '#pre_render' => array('drupal_pre_render_conditional_comments'),
283 284 285
    '#attributes' => array(),
    '#value' => NULL,
  );
286 287 288 289 290 291
  $types['styles'] = array(
    '#items' => array(),
    '#pre_render' => array('drupal_pre_render_styles'),
    '#group_callback' => 'drupal_group_css',
    '#aggregate_callback' => 'drupal_aggregate_css',
  );
292 293 294 295 296 297
  $types['scripts'] = array(
    '#items' => array(),
    '#pre_render' => array('drupal_pre_render_scripts'),
    '#group_callback' => 'drupal_group_js',
    '#aggregate_callback' => 'drupal_aggregate_js',
  );
298

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

504 505
  // Form structure.
  $types['item'] = array(
506
    '#markup' => '',
507
    '#pre_render' => array('drupal_pre_render_markup'),
508
    '#theme_wrappers' => array('form_element'),
509
  );
510
  $types['hidden'] = array(
511
    '#input' => TRUE,
512
    '#process' => array('ajax_process_form'),
513
    '#theme' => 'hidden',
514
  );
515
  $types['value'] = array(
516 517
    '#input' => TRUE,
  );
518
  $types['markup'] = array(
519
    '#markup' => '',
520 521 522 523
    '#pre_render' => array('drupal_pre_render_markup'),
  );
  $types['link'] = array(
    '#pre_render' => array('drupal_pre_render_link', 'drupal_pre_render_markup'),
524
  );
525
  $types['fieldset'] = array(
526 527 528
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
    '#value' => NULL,
529
    '#process' => array('form_process_fieldset', 'ajax_process_form'),
530
    '#pre_render' => array('form_pre_render_fieldset'),
531
    '#theme_wrappers' => array('fieldset'),
532
  );
533
  $types['vertical_tabs'] = array(
534
    '#theme_wrappers' => array('vertical_tabs'),
535 536 537
    '#default_tab' => '',
    '#process' => array('form_process_vertical_tabs'),
  );
538 539 540 541 542 543 544 545
  $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'),
  );
546 547 548 549 550

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

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

562
  return $types;
563 564
}

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

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

700
  foreach (list_themes() as $key => $theme) {
701
    $items['admin/appearance/settings/' . $theme->name] = array(
702 703 704 705
      'title' => $theme->info['name'],
      'page arguments' => array('system_theme_settings', $theme->name),
      'type' => MENU_LOCAL_TASK,
      'access callback' => '_system_themes_access',
706
      'access arguments' => array($key),
707
      'file' => 'system.admin.inc',
708
    );
Dries's avatar
 
Dries committed
709
  }
drumm's avatar
drumm committed
710

711
  // Modules.
712
  $items['admin/modules'] = array(
713 714
    'title' => 'Extend',
    'description' => 'Add and enable modules to extend site functionality.',
715 716
    'page callback' => 'drupal_get_form',
    'page arguments' => array('system_modules'),
717
    'access arguments' => array('administer modules'),
718
    'file' => 'system.admin.inc',
719
    'weight' => -2,
720
  );
721
  $items['admin/modules/list'] = array(
722
    'title' => 'List',
723 724
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );