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

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

8 9
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Cache\Cache;
10
use Drupal\Core\Language\Language;
11
use Drupal\Core\Utility\ModuleInfo;
12
use Drupal\user\UserInterface;
13
use Symfony\Component\HttpFoundation\JsonResponse;
14
use Symfony\Component\HttpFoundation\RedirectResponse;
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
      if (\Drupal::moduleHandler()->moduleExists('update')) {
107
        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.') . '</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
      if (\Drupal::currentUser()->id() == 1) {
127
        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>';
128
      }
129
      break;
130
    case 'admin/reports/status':
131
      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>';
132
  }
Dries's avatar
 
Dries committed
133 134
}

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

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

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

243 244 245
  return $hooks;
}

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

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

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

  $types['container'] = array(
564 565
    '#process' => array('form_process_group', 'form_process_container'),
    '#pre_render' => array('form_pre_render_group'),
566
    '#theme_wrappers' => array('container'),
567
  );
568
  $types['actions'] = array(
569
    '#process' => array('form_pre_render_actions_dropbutton', 'form_process_actions', 'form_process_container'),
570
    '#weight' => 100,
571
    '#theme_wrappers' => array('container'),
572 573
  );

574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597
  $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',
  );

598 599 600 601 602 603 604
  // Other elements.
  $types['render_cache_placeholder'] = array(
    '#callback' => '',
    '#context' => array(),
    '#pre_render' => array('drupal_pre_render_render_cache_placeholder'),
  );

605
  return $types;
606 607
}

Dries's avatar
 
Dries committed
608
/**
609
 * Implements hook_menu().
Dries's avatar
 
Dries committed
610
 */
611 612
function system_menu() {
  $items['admin'] = array(
613
    'title' => 'Administration',
614
    'route_name' => 'system.admin',
615
    'weight' => 9,
616
    'menu_name' => 'admin',
617
  );
618

619
  // Menu items that are basically just menu blocks.
620 621
  $items['admin/structure'] = array(
    'title' => 'Structure',
622
    'description' => 'Administer blocks, content types, menus, etc.',
623
    'position' => 'right',
624
    'weight' => -8,
625
    'route_name' => 'system.admin_structure',
626
  );
627 628 629
  // Appearance.
  $items['admin/appearance'] = array(
    'title' => 'Appearance',
630
    'description' => 'Select and configure your themes.',
631
    'route_name' => 'system.themes_page',
632
    'position' => 'left',
633
    'weight' => -6,
634
  );
drumm's avatar
drumm committed
635

636
  // Modules.
637
  $items['admin/modules'] = array(
638 639
    'title' => 'Extend',
    'description' => 'Add and enable modules to extend site functionality.',
640
    'route_name' => 'system.modules_list',
641
    'weight' => -2,
642
  );
643

644
  // Configuration.
645 646
  $items['admin/config'] = array(
    'title' => 'Configuration',
647
    'description' => 'Administer settings.',
648
    'route_name' => 'system.admin_config',
649 650
  );

651
  // Media settings.
652
  $items['admin/config/media'] = array(
653 654 655
    'title' => 'Media',
    'description' => 'Media tools.',
    'position' => 'left',
656
    'weight' => -10,
657
    'route_name' => 'system.admin_config_media',
658 659
  );
  $items['admin/config/media/file-system'] = array(
660
    'title' => 'File system',
661
    'description' => 'Tell Drupal where to store uploaded files and how they are accessed.',
662
    'route_name' => 'system.file_system_settings',
663
    'weight' => -10,
664
  );
665
  $items['admin/config/media/image-toolkit'] = array(
666 667
    'title' => 'Image toolkit',
    'description' => 'Choose which image toolkit to use if you have installed optional toolkits.',
668
    'route_name' => 'system.image_toolkit_settings',
669
    'weight' => 20,
670
  );
671 672

  // Service settings.
673 674 675
  $items['admin/config/services'] = array(
    'title' => 'Web services',
    'description' => 'Tools related to web services.',
676 677
    'position' => 'right',
    'weight' => 0,
678
    'route_name' => 'system.admin_config_services',
679
  );
680 681 682
  $items['admin/config/services/rss-publishing'] = array(
    'title' => 'RSS publishing',
    'description' => 'Configure the site description, the number of items per feed and whether feeds should be titles/teasers/full-text.',
683
    'route_name' => 'system.rss_feeds_settings',
684
  );
685 686 687 688 689

  // Development settings.
  $items['admin/config/development'] = array(
    'title' => 'Development',
    'description' => 'Development tools.',
690 691
    'position' => 'right',
    'weight' => -10,
692
    'route_name' => 'system.admin_config_development',
693 694 695 696
  );
  $items['admin/config/development/maintenance'] = array(
    'title' => 'Maintenance mode',
    'description' => 'Take the site offline for maintenance or bring it back online.',
697
    'route_name' => 'system.site_maintenance_mode',
698
    'weight' => -10,
699 700 701 702
  );
  $items['admin/config/development/performance'] = array(
    'title' => 'Performance',
    'description' => 'Enable or disable page caching for anonymous users and set CSS and JS bandwidth optimization options.',
703
    'route_name' => 'system.performance_settings',
704
    'weight' => -20,
705
  );
706
  $items['admin/config/development/logging'] = array(
707 708
    'title' => 'Logging and errors',
    'description' => "Settings for logging and alerts modules. Various modules can route Drupal's system events to different destinations, such as syslog, database, email, etc.",
709
    'route_name' => 'system.logging_settings',
710
    'weight' => -15,
711
  );
712 713

  // Regional and date settings.
714
  $items['admin/config/regional'] = array(
715 716 717