system.module 137 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\Database\Database;
9
use Drupal\Core\Utility\ModuleInfo;
10
use Drupal\Core\TypedData\Primitive;
11
use Drupal\system\Plugin\block\block\SystemMenuBlock;
12
use Symfony\Component\HttpFoundation\JsonResponse;
13
14
use Symfony\Component\HttpFoundation\Response;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

247
248
249
  return $hooks;
}

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

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

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

  $types['container'] = array(
573
574
    '#process' => array('form_process_group', 'form_process_container'),
    '#pre_render' => array('form_pre_render_group'),
575
    '#theme_wrappers' => array('container'),
576
  );
577
  $types['actions'] = array(
578
    '#process' => array('form_pre_render_actions_dropbutton', 'form_process_actions', 'form_process_container'),
579
    '#weight' => 100,
580
    '#theme_wrappers' => array('container'),
581
582
  );

583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
  $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',
  );

607
  return $types;
608
609
}

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

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

736
  foreach (list_themes() as $key => $theme) {
737
    $items['admin/appearance/settings/' . $theme->name] = array(
738
739
740
741
      'title' => $theme->info['name'],
      'page arguments' => array('system_theme_settings', $theme->name),
      'type' => MENU_LOCAL_TASK,
      'access callback' => '_system_themes_access',
742
      'access arguments' => array($key),
743
      'file' => 'system.admin.inc',
744
    );
Dries's avatar
   
Dries committed
745
  }
drumm's avatar
drumm committed
746

747
  // Modules.
748
  $items['admin/modules'] = array(
749
750
    'title' => 'Extend',
    'description' => 'Add and enable modules to extend site functionality.',
751
752
    'page callback' => 'drupal_get_form',
    'page arguments' => array('system_modules'),
753
    'access arguments' => array('administer modules'),
754
    'file' => 'system.admin.inc',
755
    'weight' => -2,
756
  );
757
  $items['admin/modules/list'] = array(
758
    'title' => 'List',
759
760
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
761
  $items['admin/modules/list/confirm'] = array(
762
    'title' => 'List',
763
    'access arguments' => array('administer modules'),
764
    'type' => MENU_VISIBLE_IN_BREADCRUMB,
765
  );