system.module 99.1 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 260
    '#show_messages' => TRUE,
    '#theme' => 'page',
  );
261
  // By default, we don't want Ajax commands being rendered in the context of an
262 263
  // 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
264
  // debugging page that displays rather than executes Ajax commands).
265 266 267 268
  $types['ajax'] = array(
    '#header' => TRUE,
    '#commands' => array(),
    '#error' => NULL,
269
  );
270
  $types['html_tag'] = array(
271
    '#pre_render' => array('drupal_pre_render_conditional_comments', 'drupal_pre_render_html_tag'),
272 273 274
    '#attributes' => array(),
    '#value' => NULL,
  );
275 276 277 278
  $types['styles'] = array(
    '#items' => array(),
    '#pre_render' => array('drupal_pre_render_styles'),
  );
279 280 281 282
  $types['scripts'] = array(
    '#items' => array(),
    '#pre_render' => array('drupal_pre_render_scripts'),
  );
283

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

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

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

573 574 575 576 577 578 579 580 581 582 583 584 585 586
  $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.
587 588 589 590
    // The value is a list of arrays that are passed to
    // drupal_attach_tabledrag(). drupal_pre_render_table() prepends the HTML ID
    // of the table to each set of options.
    // @see drupal_attach_tabledrag()
591 592 593 594 595 596
    '#tabledrag' => array(),
    // Render properties.
    '#pre_render' => array('drupal_pre_render_table'),
    '#theme' => 'table',
  );

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

604
  return $types;
605 606
}

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

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

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

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

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

  // Service settings.
672 673 674
  $items['admin/config/services'] = array(
    'title' => 'Web services',
    'description' => 'Tools related to web services.',
675 676
    'position' => 'right',
    'weight' => 0,
677
    'route_name' => 'system.admin_config_services',
678
  );
679 680 681
  $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.',
682
    'route_name' => 'system.rss_feeds_settings',
683
  );
684 685 686 687 688

  // Development settings.
  $items['admin/config/development'] = array(
    'title' => 'Development',
    'description' => 'Development tools.',
689 690
    'position' => 'right',
    'weight' => -10,
691
    'route_name' => 'system.admin_config_development',
692 693 694 695
  );
  $items['admin/config/development/maintenance'] = array(
    'title' => 'Maintenance mode',
    'description' => 'Take the site offline for maintenance or bring it back online.',
696
    'route_name' => 'system.site_maintenance_mode',
697
    'weight' => -10,
698 699 700 701
  );
  $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.',
702
    'route_name' => 'system.performance_settings',
703
    'weight' => -20,
704
  );
705
  $items['admin/config/development/logging'] = array(
706 707
    '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.",
708
    'route_name' => 'system.logging_settings',
709
    'weight' => -15,
710
  );
711 712

  // Regional and date settings.
713
  $items['admin/config/regional'] = array(
714 715 716
    'title' => 'Regional and language',
    'description' => 'Regional settings, localization and translation.',
    'position' => 'left',