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

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

8
9
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Cache\Cache;
10
use Drupal\Core\Language\Language;
11
use Drupal\Core\Utility\ModuleInfo;
12
use Drupal\Core\TypedData\Primitive;
13
use Drupal\system\Plugin\Block\SystemMenuBlock;
14
use Symfony\Component\HttpFoundation\JsonResponse;
15
use Symfony\Component\HttpFoundation\Response;
16
17
use Guzzle\Http\Exception\BadResponseException;
use Guzzle\Http\Exception\RequestException;
18

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

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

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

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

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

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

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

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

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

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

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

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

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

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

251
252
253
  return $hooks;
}

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

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

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

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

588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
  $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',
  );

612
  return $types;
613
614
}

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

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

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

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