system.module 133 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
9
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Cache\Cache;
10
use Drupal\Core\Language\Language;
11
use Drupal\Core\Database\Database;
12
use Drupal\Core\Utility\ModuleInfo;
13
use Drupal\Core\TypedData\Primitive;
14
use Drupal\system\Plugin\Block\SystemMenuBlock;
15
use Symfony\Component\HttpFoundation\JsonResponse;
16
use Symfony\Component\HttpFoundation\Response;
17
18
use Guzzle\Http\Exception\BadResponseException;
use Guzzle\Http\Exception\RequestException;
19

20
21
22
/**
 * Maximum age of temporary files in seconds.
 */
23
const DRUPAL_MAXIMUM_TEMP_FILE_AGE = 21600;
24

25
26
27
/**
 * New users will be set to the default time zone at registration.
 */
28
const DRUPAL_USER_TIMEZONE_DEFAULT = 0;
29
30
31
32

/**
 * New users will get an empty time zone at registration.
 */
33
const DRUPAL_USER_TIMEZONE_EMPTY = 1;
34
35
36
37

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

40
41
42
 /**
 * Disabled option on forms and settings
 */
43
const DRUPAL_DISABLED = 0;
44
45
46
47

/**
 * Optional option on forms and settings
 */
48
const DRUPAL_OPTIONAL = 1;
49
50
51
52

/**
 * Required option on forms and settings
 */
53
const DRUPAL_REQUIRED = 2;
54

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

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

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

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

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

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

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

252
253
254
  return $hooks;
}

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

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

520
521
  // Form structure.
  $types['item'] = array(
522
523
524
525
526
527
    // 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,
528
    '#markup' => '',
529
    '#theme_wrappers' => array('form_element'),
530
  );
531
  $types['hidden'] = array(
532
    '#input' => TRUE,
533
    '#process' => array('ajax_process_form'),
534
535
536
537
538
539
540
    '#pre_render' => array('form_pre_render_hidden'),
    '#theme' => 'input__hidden',
  );
  $types['token'] = array(
    '#input' => TRUE,
    '#pre_render' => array('form_pre_render_hidden'),
    '#theme' => 'input__hidden',
541
  );
542
  $types['value'] = array(
543
544
    '#input' => TRUE,
  );
545
  $types['markup'] = array(
546
    '#markup' => '',
547
548
  );
  $types['link'] = array(
549
    '#pre_render' => array('drupal_pre_render_link'),
550
  );
551
  $types['fieldset'] = array(
552
    '#value' => NULL,
553
554
    '#process' => array('form_process_group', 'ajax_process_form'),
    '#pre_render' => array('form_pre_render_group'),
555
556
557
    '#theme_wrappers' => array('fieldset'),
  );
  $types['details'] = array(
558
559
    '#collapsed' => FALSE,
    '#value' => NULL,
560
561
    '#process' => array('form_process_group', 'ajax_process_form'),
    '#pre_render' => array('form_pre_render_details', 'form_pre_render_group'),
562
    '#theme_wrappers' => array('details'),
563
  );
564
  $types['vertical_tabs'] = array(
565
566
    '#default_tab' => '',
    '#process' => array('form_process_vertical_tabs'),
567
568
    '#pre_render' => array('form_pre_render_vertical_tabs'),
    '#theme_wrappers' => array('vertical_tabs', 'form_element'),
569
  );
570
571
  $types['dropbutton'] = array(
    '#pre_render' => array('drupal_pre_render_dropbutton'),
572
    '#theme' => 'links__dropbutton',
573
574
575
  );
  $types['operations'] = array(
    '#pre_render' => array('drupal_pre_render_dropbutton'),
576
    '#theme' => 'links__dropbutton__operations',
577
  );
578
579

  $types['container'] = array(
580
581
    '#process' => array('form_process_group', 'form_process_container'),
    '#pre_render' => array('form_pre_render_group'),
582
    '#theme_wrappers' => array('container'),
583
  );
584
  $types['actions'] = array(
585
    '#process' => array('form_pre_render_actions_dropbutton', 'form_process_actions', 'form_process_container'),
586
    '#weight' => 100,
587
    '#theme_wrappers' => array('container'),
588
589
  );

590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
  $types['table'] = array(
    '#header' => array(),
    '#rows' => array(),
    '#empty' => '',
    // Properties for tableselect support.
    '#input' => TRUE,
    '#tree' => TRUE,
    '#tableselect' => FALSE,
    '#multiple' => TRUE,
    '#js_select' => TRUE,
    '#value_callback' => 'form_type_table_value',
    '#process' => array('form_process_table'),
    '#element_validate' => array('form_validate_table'),
    // Properties for tabledrag support.
    // The value is a list of arrays that are passed to drupal_add_tabledrag().
    // drupal_pre_render_table() prepends the HTML ID of the table to each set
    // of arguments.
    // @see drupal_add_tabledrag()
    '#tabledrag' => array(),
    // Render properties.
    '#pre_render' => array('drupal_pre_render_table'),
    '#theme' => 'table',
  );

614
  return $types;
615
616
}

Dries's avatar
   
Dries committed
617
/**
618
 * Implements hook_menu().
Dries's avatar
   
Dries committed
619
 */
620
621
function system_menu() {
  $items['system/files'] = array(
622
    'title' => 'File download',
623
    'page callback' => 'file_download',
624
625
626
627
628
629
630
631
    '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'),
632
    'access callback' => TRUE,
633
634
    'type' => MENU_CALLBACK,
  );
635
  $items['system/ajax'] = array(
636
    'title' => 'AHAH callback',
637
    'page callback' => 'ajax_form_callback',
638
    'access callback' => TRUE,
639
    'theme callback' => 'ajax_base_page_theme',
640
    'type' => MENU_CALLBACK,
641
    'file path' => 'core/includes',
642
    'file' => 'form.inc',
643
  );
644
645
646
647
648
  $items['system/timezone'] = array(
    'title' => 'Time zone',
    'page callback' => 'system_timezone',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
649
    'file' => 'system.admin.inc',
650
  );
651
  $items['admin'] = array(
652
    'title' => 'Administration',
653
    'access arguments' => array('access administration pages'),
654
    'page callback' => 'system_admin_menu_block_page',
655
    'weight' => 9,
656
    'menu_name' => 'admin',
657
    'file' => 'system.admin.inc',
658
659
  );
  $items['admin/compact'] = array(
660
    'title' => 'Compact mode',
661
    'page callback' => 'system_admin_compact_page',
662
    'access arguments' => array('access administration pages'),
663
    'type' => MENU_CALLBACK,
664
    'file' => 'system.admin.inc',
665
  );
666
667
  $items['admin/tasks'] = array(
    'title' => 'Tasks',
668
    'type' => MENU_DEFAULT_LOCAL_TASK,
669
    'weight' => -20,
670
  );
671
672
673
  $items['admin/index'] = array(
    'title' => 'Index',
    'page callback' => 'system_admin_index',
674
    'access arguments' => array('access administration pages'),
675
    'type' => MENU_LOCAL_TASK,
676
    'weight' => -18,
677
    'file' => 'system.admin.inc',
678
  );
679

680
  // Menu items that are basically just menu blocks.
681
682
  $items['admin/structure'] = array(
    'title' => 'Structure',
683
    'description' => 'Administer blocks, content types, menus, etc.',
684
    'position' => 'right',
685
    'weight' => -8,
686
    'page callback' => 'system_admin_menu_block_page',
687
    'access arguments' => array('access administration pages'),
688
    'file' => 'system.admin.inc',
689
  );
690
691
692
  // Appearance.
  $items['admin/appearance'] = array(
    'title' => 'Appearance',
693
    'description' => 'Select and configure your themes.',
694
    'page callback' => 'system_themes_page',
695
    'access arguments' => array('administer themes'),
696
    'position' => 'left',
697
    'weight' => -6,
698
    'file' => 'system.admin.inc',
699
  );
700
  $items['admin/appearance/list'] = array(
701
    'title' => 'List',
702
    'description' => 'Select and configure your theme',
703
    'type' => MENU_DEFAULT_LOCAL_TASK,
704
    'file' => 'system.admin.inc',
705
  );
706
707
708
  $items['admin/appearance/default'] = array(
    'title' => 'Set default theme',
    'page callback' => 'system_theme_default',
709
    'access arguments' => array('administer themes'),
710
711
712
    'type' => MENU_CALLBACK,
    'file' => 'system.admin.inc',
  );
713
  $items['admin/appearance/settings'] = array(
714
    'title' => 'Settings',
715
    'description' => 'Configure default and theme specific settings.',
716
    'page callback' => 'drupal_get_form',
717
    'page arguments' => array('system_theme_settings'),
718
    'access arguments' => array('administer themes'),
719
    'type' => MENU_LOCAL_TASK,
720
    'file' => 'system.admin.inc',
721
    'weight' => 100,
722
  );
723
  // Theme configuration subtabs.
724
  $items['admin/appearance/settings/global'] = array(
725
    'title' => 'Global settings',
726
727
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
Dries's avatar
   
Dries committed
728

729
  foreach (list_themes() as $key => $theme) {
730
    $items['admin/appearance/settings/' . $theme->name] = array(
731
732
733
734
      'title' => $theme->info['name'],
      'page arguments' => array('system_theme_settings', $theme->name),
      'type' => MENU_LOCAL_TASK,
      'access callback' => '_system_themes_access',
735
      'access arguments' => array($key),
736
      'file' => 'system.admin.inc',
737
    );
Dries's avatar
   
Dries committed
738
  }
drumm's avatar
drumm committed
739

740
  // Modules.
741
  $items['admin/modules'] = array(
742
743
    'title' => 'Extend',
    'description' => 'Add and enable modules to extend site functionality.',
744
745
    'page callback' => 'drupal_get_form',
    'page arguments' => array('system_modules'),
746
    'access arguments' => array('administer modules'),
747
    'file' => 'system.admin.inc',
748
    'weight' => -2,
749
  );
750
  $items['admin/modules/list'] = array(
751
    'title' => 'List',
752
753
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
754
  $items['admin/modules/list/confirm'] = array(
755
    'title' => 'List',
Dries's avatar