system.module 148 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 Symfony\Component\HttpFoundation\Response;

10
11
12
/**
 * Maximum age of temporary files in seconds.
 */
13
const DRUPAL_MAXIMUM_TEMP_FILE_AGE = 21600;
14

15
16
17
/**
 * New users will be set to the default time zone at registration.
 */
18
const DRUPAL_USER_TIMEZONE_DEFAULT = 0;
19
20
21
22

/**
 * New users will get an empty time zone at registration.
 */
23
const DRUPAL_USER_TIMEZONE_EMPTY = 1;
24
25
26
27

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

30
31
32
 /**
 * Disabled option on forms and settings
 */
33
const DRUPAL_DISABLED = 0;
34
35
36
37

/**
 * Optional option on forms and settings
 */
38
const DRUPAL_OPTIONAL = 1;
39
40
41
42

/**
 * Required option on forms and settings
 */
43
const DRUPAL_REQUIRED = 2;
44

45
46
47
48
49
50
51
/**
 * Maximum number of values in a weight select element.
 *
 * If the number of values is over the maximum, a text field is used instead.
 */
const DRUPAL_WEIGHT_SELECT_MAX = 100;

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

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

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

72
  switch ($path) {
73
    case 'admin/help#system':
74
75
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
76
      $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>';
77
78
79
      $output .= '<h3>' . t('Uses') . '</h3>';
      $output .= '<dl>';
      $output .= '<dt>' . t('Managing modules') . '</dt>';
80
      $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>';
81
82
83
84
85
      $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>';
86
      $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>';
87
      $output .= '<dt>' . t('Configuring basic site settings') . '</dt>';
88
      $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>';
89
      $output .= '<dt>' . t('Configuring actions') . '</dt>';
90
      $output .= '<dd>' . t('Actions are individual tasks that the system can do, such as unpublishing a piece of content or banning a user. Other modules can fire these actions when certain system events happen; for example, when a new post is added or when a user logs in. Modules may also provide additional actions. Visit the <a href="@actions">Actions page</a> to configure actions.', array('@actions' => url('admin/config/system/actions'))) . '</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
132
    case 'admin/config/system/actions':
    case 'admin/config/system/actions/manage':
133
      $output = '';
134
      $output .= '<p>' . t('There are two types of actions: simple and advanced. Simple actions do not require any additional configuration and are listed here automatically. Advanced actions need to be created and configured before they can be used because they have options that need to be specified; for example, sending an e-mail to a specified address or unpublishing content containing certain words. To create an advanced action, select the action from the drop-down list in the advanced action section below and click the <em>Create</em> button.') . '</p>';
135
      return $output;
136
    case 'admin/config/system/actions/configure':
137
      return t('An advanced action offers additional configuration options which may be filled out below. Changing the <em>Description</em> field is recommended in order to better identify the precise action taking place.');
138
    case 'admin/config/people/ip-blocking':
139
      return '<p>' . t('IP addresses listed here are blocked from your site. Blocked addresses are completely forbidden from accessing the site and instead see a brief message explaining the situation.') . '</p>';
140
    case 'admin/reports/status':
141
      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.") . '</p>';
142
  }
Dries's avatar
   
Dries committed
143
144
}

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

Dries's avatar
   
Dries committed
208
/**
209
 * Implements hook_permission().
Dries's avatar
   
Dries committed
210
 */
211
function system_permission() {
212
  return array(
213
214
215
    'administer modules' => array(
      'title' => t('Administer modules'),
    ),
216
217
    'administer site configuration' => array(
      'title' => t('Administer site configuration'),
218
      'restrict access' => TRUE,
219
    ),
220
221
222
    'administer themes' => array(
      'title' => t('Administer themes'),
    ),
223
    'administer software updates' => array(
224
225
      'title' => t('Administer software updates'),
      'restrict access' => TRUE,
226
    ),
227
228
229
230
    'administer actions' => array(
      'title' => t('Administer actions'),
    ),
    'access administration pages' => array(
231
      'title' => t('Use the administration pages and help'),
232
    ),
233
    'access site in maintenance mode' => array(
234
      'title' => t('Use the site in maintenance mode'),
235
    ),
236
237
238
239
    'view the administration theme' => array(
      'title' => t('View the administration theme'),
      'description' => variable_get('admin_theme') ? '' : t('This is only used when the site is configured to use a separate administration theme on the <a href="@appearance-url">Appearance</a> page.', array('@appearance-url' => url('admin/appearance'))),
    ),
240
    'access site reports' => array(
241
      'title' => t('View site reports'),
242
243
244
245
    ),
    'block IP addresses' => array(
      'title' => t('Block IP addresses'),
    ),
246
  );
Dries's avatar
   
Dries committed
247
248
}

249
/**
250
 * Implements hook_hook_info().
251
252
253
254
255
 */
function system_hook_info() {
  $hooks['token_info'] = array(
    'group' => 'tokens',
  );
256
257
258
  $hooks['token_info_alter'] = array(
    'group' => 'tokens',
  );
259
260
261
  $hooks['tokens'] = array(
    'group' => 'tokens',
  );
262
263
264
265
  $hooks['tokens_alter'] = array(
    'group' => 'tokens',
  );

266
267
268
  return $hooks;
}

269
/**
270
 * Implements hook_entity_info().
271
272
273
274
275
 */
function system_entity_info() {
  return array(
    'file' => array(
      'label' => t('File'),
276
      'base table' => 'file_managed',
277
278
      'controller class' => 'Drupal\Core\File\FileStorageController',
      'entity class' => 'Drupal\Core\File\File',
279
      'entity keys' => array(
280
        'id' => 'fid',
281
        'label' => 'filename',
282
283
284
285
286
287
      ),
      'static cache' => FALSE,
    ),
  );
}

288
/**
289
 * Implements hook_element_info().
290
 */
291
292
293
function system_element_info() {
  // Top level elements.
  $types['form'] = array(
294
295
    '#method' => 'post',
    '#action' => request_uri(),
296
    '#theme_wrappers' => array('form'),
297
  );
298
  $types['page'] = array(
299
300
    '#show_messages' => TRUE,
    '#theme' => 'page',
301
    '#theme_wrappers' => array('html'),
302
  );
303
  // By default, we don't want Ajax commands being rendered in the context of an
304
305
  // 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
306
  // debugging page that displays rather than executes Ajax commands).
307
308
309
310
  $types['ajax'] = array(
    '#header' => TRUE,
    '#commands' => array(),
    '#error' => NULL,
311
  );
312
313
  $types['html_tag'] = array(
    '#theme' => 'html_tag',
314
    '#pre_render' => array('drupal_pre_render_conditional_comments'),
315
316
317
    '#attributes' => array(),
    '#value' => NULL,
  );
318
319
320
321
322
323
  $types['styles'] = array(
    '#items' => array(),
    '#pre_render' => array('drupal_pre_render_styles'),
    '#group_callback' => 'drupal_group_css',
    '#aggregate_callback' => 'drupal_aggregate_css',
  );
324
325
326
327
328
329
  $types['scripts'] = array(
    '#items' => array(),
    '#pre_render' => array('drupal_pre_render_scripts'),
    '#group_callback' => 'drupal_group_js',
    '#aggregate_callback' => 'drupal_aggregate_js',
  );
330

331
332
  // Input elements.
  $types['submit'] = array(
333
334
335
336
    '#input' => TRUE,
    '#name' => 'op',
    '#button_type' => 'submit',
    '#executes_submit_callback' => TRUE,
337
    '#limit_validation_errors' => FALSE,
338
    '#process' => array('form_process_button', 'ajax_process_form'),
339
    '#theme_wrappers' => array('button'),
340
  );
341
  $types['button'] = array(
342
343
344
345
    '#input' => TRUE,
    '#name' => 'op',
    '#button_type' => 'submit',
    '#executes_submit_callback' => FALSE,
346
    '#limit_validation_errors' => FALSE,
347
    '#process' => array('form_process_button', 'ajax_process_form'),
348
    '#theme_wrappers' => array('button'),
349
  );
350
  $types['image_button'] = array(
351
352
353
    '#input' => TRUE,
    '#button_type' => 'submit',
    '#executes_submit_callback' => TRUE,
354
    '#limit_validation_errors' => FALSE,
355
    '#process' => array('form_process_button', 'ajax_process_form'),
356
357
358
    '#return_value' => TRUE,
    '#has_garbage_value' => TRUE,
    '#src' => NULL,
359
    '#theme_wrappers' => array('image_button'),
360
  );
361
  $types['textfield'] = array(
362
363
364
365
    '#input' => TRUE,
    '#size' => 60,
    '#maxlength' => 128,
    '#autocomplete_path' => FALSE,
366
    '#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern'),
367
    '#theme' => 'textfield',
368
    '#theme_wrappers' => array('form_element'),
369
  );
370
371
372
373
374
  $types['tel'] = array(
    '#input' => TRUE,
    '#size' => 30,
    '#maxlength' => 128,
    '#autocomplete_path' => FALSE,
375
    '#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern'),
376
377
378
    '#theme' => 'tel',
    '#theme_wrappers' => array('form_element'),
  );
379
380
381
382
383
  $types['email'] = array(
    '#input' => TRUE,
    '#size' => 60,
    '#maxlength' => EMAIL_MAX_LENGTH,
    '#autocomplete_path' => FALSE,
384
    '#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern'),
385
386
387
388
    '#element_validate' => array('form_validate_email'),
    '#theme' => 'email',
    '#theme_wrappers' => array('form_element'),
  );
389
390
391
392
393
  $types['url'] = array(
    '#input' => TRUE,
    '#size' => 60,
    '#maxlength' => 255,
    '#autocomplete_path' => FALSE,
394
    '#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern'),
395
396
397
398
    '#element_validate' => array('form_validate_url'),
    '#theme' => 'url',
    '#theme_wrappers' => array('form_element'),
  );
399
400
401
402
403
  $types['search'] = array(
    '#input' => TRUE,
    '#size' => 60,
    '#maxlength' => 128,
    '#autocomplete_path' => FALSE,
404
    '#process' => array('form_process_autocomplete', 'ajax_process_form'),
405
406
407
    '#theme' => 'search',
    '#theme_wrappers' => array('form_element'),
  );
408
409
410
411
412
413
414
415
  $types['number'] = array(
    '#input' => TRUE,
    '#step' => 1,
    '#process' => array('ajax_process_form'),
    '#element_validate' => array('form_validate_number'),
    '#theme' => 'number',
    '#theme_wrappers' => array('form_element'),
  );
416
417
418
419
420
421
422
423
424
425
  $types['range'] = array(
    '#input' => TRUE,
    '#step' => 1,
    '#min' => 0,
    '#max' => 100,
    '#process' => array('ajax_process_form'),
    '#element_validate' => array('form_validate_number'),
    '#theme' => 'range',
    '#theme_wrappers' => array('form_element'),
  );
426
427
428
429
430
431
432
  $types['machine_name'] = array(
    '#input' => TRUE,
    '#default_value' => NULL,
    '#required' => TRUE,
    '#maxlength' => 64,
    '#size' => 60,
    '#autocomplete_path' => FALSE,
433
    '#process' => array('form_process_machine_name', 'form_process_autocomplete', 'ajax_process_form'),
434
435
436
437
    '#element_validate' => array('form_validate_machine_name'),
    '#theme' => 'textfield',
    '#theme_wrappers' => array('form_element'),
  );
438
  $types['password'] = array(
439
440
441
    '#input' => TRUE,
    '#size' => 60,
    '#maxlength' => 128,
442
    '#process' => array('ajax_process_form', 'form_process_pattern'),
443
    '#theme' => 'password',
444
    '#theme_wrappers' => array('form_element'),
445
  );
446
  $types['password_confirm'] = array(
447
    '#input' => TRUE,
448
    '#process' => array('form_process_password_confirm', 'user_form_process_password_confirm'),
449
    '#theme_wrappers' => array('form_element'),
450
  );
451
  $types['textarea'] = array(
452
453
454
    '#input' => TRUE,
    '#cols' => 60,
    '#rows' => 5,
455
    '#resizable' => 'vertical',
456
    '#process' => array('ajax_process_form'),
457
    '#theme' => 'textarea',
458
    '#theme_wrappers' => array('form_element'),
459
  );
460
  $types['radios'] = array(
461
    '#input' => TRUE,
462
    '#process' => array('form_process_radios'),
463
    '#theme_wrappers' => array('radios'),
464
    '#pre_render' => array('form_pre_render_conditional_form_element'),
465
  );
466
  $types['radio'] = array(
467
468
    '#input' => TRUE,
    '#default_value' => NULL,
469
    '#process' => array('ajax_process_form'),
470
    '#theme' => 'radio',
471
    '#theme_wrappers' => array('form_element'),
472
    '#title_display' => 'after',
473
  );
474
  $types['checkboxes'] = array(
475
    '#input' => TRUE,
476
    '#process' => array('form_process_checkboxes'),
477
    '#theme_wrappers' => array('checkboxes'),
478
    '#pre_render' => array('form_pre_render_conditional_form_element'),
479
  );
480
  $types['checkbox'] = array(
481
482
    '#input' => TRUE,
    '#return_value' => 1,
483
    '#theme' => 'checkbox',
484
    '#process' => array('form_process_checkbox', 'ajax_process_form'),
485
    '#theme_wrappers' => array('form_element'),
486
    '#title_display' => 'after',
487
  );
488
  $types['select'] = array(
489
490
    '#input' => TRUE,
    '#multiple' => FALSE,
491
    '#process' => array('form_process_select', 'ajax_process_form'),
492
    '#theme' => 'select',
493
    '#theme_wrappers' => array('form_element'),
494
  );
495
  $types['weight'] = array(
496
497
498
    '#input' => TRUE,
    '#delta' => 10,
    '#default_value' => 0,
499
    '#process' => array('form_process_weight', 'ajax_process_form'),
500
  );
501
  $types['date'] = array(
502
503
    '#input' => TRUE,
    '#element_validate' => array('date_validate'),
504
    '#process' => array('form_process_date'),
505
    '#theme' => 'date',
506
    '#theme_wrappers' => array('form_element'),
507
  );
508
  $types['file'] = array(
509
510
    '#input' => TRUE,
    '#size' => 60,
511
    '#theme' => 'file',
512
    '#theme_wrappers' => array('form_element'),
513
  );
514
  $types['tableselect'] = array(
515
516
517
518
519
520
    '#input' => TRUE,
    '#js_select' => TRUE,
    '#multiple' => TRUE,
    '#process' => array('form_process_tableselect'),
    '#options' => array(),
    '#empty' => '',
521
    '#theme' => 'tableselect',
522
  );
523

524
525
  // Form structure.
  $types['item'] = array(
526
    '#markup' => '',
527
    '#pre_render' => array('drupal_pre_render_markup'),
528
    '#theme_wrappers' => array('form_element'),
529
  );
530
  $types['hidden'] = array(
531
    '#input' => TRUE,
532
    '#process' => array('ajax_process_form'),
533
    '#theme' => 'hidden',
534
  );
535
  $types['value'] = array(
536
537
    '#input' => TRUE,
  );
538
  $types['markup'] = array(
539
    '#markup' => '',
540
541
542
543
    '#pre_render' => array('drupal_pre_render_markup'),
  );
  $types['link'] = array(
    '#pre_render' => array('drupal_pre_render_link', 'drupal_pre_render_markup'),
544
  );
545
  $types['fieldset'] = array(
546
547
548
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
    '#value' => NULL,
549
    '#process' => array('form_process_fieldset', 'ajax_process_form'),
550
    '#pre_render' => array('form_pre_render_fieldset'),
551
    '#theme_wrappers' => array('fieldset'),
552
  );
553
  $types['vertical_tabs'] = array(
554
    '#theme_wrappers' => array('vertical_tabs'),
555
556
557
    '#default_tab' => '',
    '#process' => array('form_process_vertical_tabs'),
  );
558
559
560
561
562

  $types['container'] = array(
    '#theme_wrappers' => array('container'),
    '#process' => array('form_process_container'),
  );
563
564
565
566
567
  $types['actions'] = array(
    '#theme_wrappers' => array('container'),
    '#process' => array('form_process_actions', 'form_process_container'),
    '#weight' => 100,
  );
568

569
  $types['token'] = array(
570
    '#input' => TRUE,
571
    '#theme' => 'hidden',
572
573
  );

574
  return $types;
575
576
}

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

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

713
  foreach (list_themes() as $key => $theme) {
714
    $items['admin/appearance/settings/' . $theme->name] = array(
715
716
717
718
      'title' => $theme->info['name'],
      'page arguments' => array('system_theme_settings', $theme->name),
      'type' => MENU_LOCAL_TASK,
      'access callback' => '_system_themes_access',
719
      'access arguments' => array($key),
720
      'file' => 'system.admin.inc',
721
    );
Dries's avatar
   
Dries committed
722
  }
drumm's avatar
drumm committed
723

724
  // Modules.
725
  $items['admin/modules'] = array(
726
    'title' => 'Modules',
727
    'description' => 'Extend site functionality.',
728
729
    'page callback' => 'drupal_get_form',
    'page arguments' => array('system_modules'),
730
    'access arguments' => array('administer modules'),
731
    'file' => 'system.admin.inc',
732
    'weight' => -2,
733
  );
734
  $items['admin/modules/list'] = array(
735
    'title' => 'List',
736
737
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
738
  $items['admin/modules/list/confirm'] = array(
739
    'title' => 'List',
740
    'access arguments' => array('administer modules'),
741
    'type' => MENU_VISIBLE_IN_BREADCRUMB,
742
  );
743
  $items['admin/modules/uninstall'] = array(
744
    'title' => 'Uninstall',
745
    'page arguments' => array('system_modules_uninstall'),
746
    'access arguments' => array('administer modules'),
747
    'type' => MENU_LOCAL_TASK,
748
    'file' => 'system.admin.inc',
749
    'weight' => 20,
750
  );
751
  $items['admin/modules/uninstall/confirm'] = array(
752
    'title' => 'Uninstall',
753
    'access arguments' => array('administer modules'),
754
    'type' => MENU_VISIBLE_IN_BREADCRUMB,
755
756
757
    'file' => 'system.admin.inc',
  );