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 9
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Cache\Cache;
10
use Drupal\Core\Database\Database;
11
use Drupal\Core\Utility\ModuleInfo;
12
use Drupal\Core\TypedData\Primitive;
13
use Drupal\system\Plugin\block\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_settings_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 279
  $types['html_tag'] = array(
    '#theme' => 'html_tag',
280
    '#pre_render' => array('drupal_pre_render_conditional_comments'),
281 282 283
    '#attributes' => array(),
    '#value' => NULL,
  );
284 285 286 287 288 289
  $types['styles'] = array(
    '#items' => array(),
    '#pre_render' => array('drupal_pre_render_styles'),
    '#group_callback' => 'drupal_group_css',
    '#aggregate_callback' => 'drupal_aggregate_css',
  );
290 291 292 293 294 295
  $types['scripts'] = array(
    '#items' => array(),
    '#pre_render' => array('drupal_pre_render_scripts'),
    '#group_callback' => 'drupal_group_js',
    '#aggregate_callback' => 'drupal_aggregate_js',
  );
296

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

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

  $types['container'] = array(
577 578
    '#process' => array('form_process_group', 'form_process_container'),
    '#pre_render' => array('form_pre_render_group'),
579
    '#theme_wrappers' => array('container'),
580
  );
581
  $types['actions'] = array(
582
    '#process' => array('form_pre_render_actions_dropbutton', 'form_process_actions', 'form_process_container'),
583
    '#weight' => 100,
584
    '#theme_wrappers' => array('container'),
585 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
  $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',
  );

611
  return $types;
612 613
}

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

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