system.module 115 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\system\Plugin\Block\SystemMenuBlock;
13
use Drupal\user\UserInterface;
14
use Symfony\Component\HttpFoundation\JsonResponse;
15
use Symfony\Component\HttpFoundation\RedirectResponse;
16
use Symfony\Component\HttpFoundation\Response;
17
18
use Guzzle\Http\Exception\BadResponseException;
use Guzzle\Http\Exception\RequestException;
19

20
21
22
/**
 * Maximum age of temporary files in seconds.
 */
23
const DRUPAL_MAXIMUM_TEMP_FILE_AGE = 21600;
24

25
26
27
/**
 * New users will be set to the default time zone at registration.
 */
28
const DRUPAL_USER_TIMEZONE_DEFAULT = 0;
29
30
31
32

/**
 * New users will get an empty time zone at registration.
 */
33
const DRUPAL_USER_TIMEZONE_EMPTY = 1;
34
35
36
37

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

40
41
42
 /**
 * Disabled option on forms and settings
 */
43
const DRUPAL_DISABLED = 0;
44
45
46
47

/**
 * Optional option on forms and settings
 */
48
const DRUPAL_OPTIONAL = 1;
49
50
51
52

/**
 * Required option on forms and settings
 */
53
const DRUPAL_REQUIRED = 2;
54

55
/**
56
 * Return only visible regions.
57
58
 *
 * @see system_region_list()
59
 */
60
const REGIONS_VISIBLE = 'visible';
61
62

/**
63
 * Return all regions.
64
65
 *
 * @see system_region_list()
66
 */
67
const REGIONS_ALL = 'all';
68

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

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

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

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

235
/**
236
 * Implements hook_hook_info().
237
238
239
240
241
 */
function system_hook_info() {
  $hooks['token_info'] = array(
    'group' => 'tokens',
  );
242
243
244
  $hooks['token_info_alter'] = array(
    'group' => 'tokens',
  );
245
246
247
  $hooks['tokens'] = array(
    'group' => 'tokens',
  );
248
249
250
251
  $hooks['tokens_alter'] = array(
    'group' => 'tokens',
  );

252
253
254
  return $hooks;
}

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

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

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

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

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

606
  return $types;
607
608
}

Dries's avatar
   
Dries committed
609
/**
610
 * Implements hook_menu().
Dries's avatar
   
Dries committed
611
 */
612
function system_menu() {
613
614
615
616
  $items['system/temporary'] = array(
    'title' => 'Temporary files',
    'page callback' => 'file_download',
    'page arguments' => array('temporary'),
617
    'access callback' => TRUE,
618
619
    'type' => MENU_CALLBACK,
  );
620
  $items['system/ajax'] = array(
621
    'title' => 'AHAH callback',
622
    'route_name' => 'system.ajax',
623
    'theme callback' => 'ajax_base_page_theme',
624
625
626
    'type' => MENU_CALLBACK,
  );
  $items['admin'] = array(
627
    'title' => 'Administration',
628
    'access arguments' => array('access administration pages'),
629
    'page callback' => 'system_admin_menu_block_page',
630
    'weight' => 9,
631
    'menu_name' => 'admin',
632
    'file' => 'system.admin.inc',
633
634
  );
  $items['admin/compact'] = array(
635
    'title' => 'Compact mode',
636
    'page callback' => 'system_admin_compact_page',
637
    'access arguments' => array('access administration pages'),
638
    'type' => MENU_CALLBACK,
639
    'file' => 'system.admin.inc',
640
  );
641
642
  $items['admin/tasks'] = array(
    'title' => 'Tasks',
643
    'type' => MENU_DEFAULT_LOCAL_TASK,
644
    'weight' => -20,
645
  );
646
647
  $items['admin/index'] = array(
    'title' => 'Index',
648
    'route_name' => 'system_admin_index',
649
    'type' => MENU_LOCAL_TASK,
650
    'weight' => -18,
651
  );
652

653
  // Menu items that are basically just menu blocks.
654
655
  $items['admin/structure'] = array(
    'title' => 'Structure',
656
    'description' => 'Administer blocks, content types, menus, etc.',
657
    'position' => 'right',
658
    'weight' => -8,
659
    'page callback' => 'system_admin_menu_block_page',
660
    'access arguments' => array('access administration pages'),
661
    'file' => 'system.admin.inc',
662
  );
663
664
665
  // Appearance.
  $items['admin/appearance'] = array(
    'title' => 'Appearance',
666
    'description' => 'Select and configure your themes.',
667
    'page callback' => 'system_themes_page',
668
    'access arguments' => array('administer themes'),
669
    'position' => 'left',
670
    'weight' => -6,
671
    'file' => 'system.admin.inc',
672
  );
673
  $items['admin/appearance/list'] = array(
674
    'title' => 'List',
675
    'description' => 'Select and configure your theme',
676
    'type' => MENU_DEFAULT_LOCAL_TASK,
677
    'file' => 'system.admin.inc',
678
  );
679
680
681
  $items['admin/appearance/default'] = array(
    'title' => 'Set default theme',
    'page callback' => 'system_theme_default',
682
    'access arguments' => array('administer themes'),
683
684
685
    'type' => MENU_CALLBACK,
    'file' => 'system.admin.inc',
  );
686
  $items['admin/appearance/settings'] = array(
687
    'title' => 'Settings',
688
    'description' => 'Configure default and theme specific settings.',
689
    'route_name' => 'system_theme_settings',
690
    'type' => MENU_LOCAL_TASK,
691
    'weight' => 100,
692
  );
693
  // Theme configuration local tasks.
694
  $items['admin/appearance/settings/global'] = array(
695
    'title' => 'Global settings',
696
697
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
Dries's avatar
   
Dries committed
698

699
700
701
702
703
704
705
706
  foreach (list_themes(TRUE) as $theme) {
    if (!empty($theme->status)) {
      $items['admin/appearance/settings/' . $theme->name] = array(
        'title' => $theme->info['name'],
        'route_name' => 'system_theme_settings_' . $theme->name,
        'type' => MENU_LOCAL_TASK,
      );
    }
Dries's avatar
   
Dries committed
707
  }
drumm's avatar
drumm committed
708

709
  // Modules.
710
  $items['admin/modules'] = array(
711
712
    'title' => 'Extend',
    'description' => 'Add and enable modules to extend site functionality.',
713
    'route_name' => 'system_modules_list',
714
    'weight' => -2,
715
  );
716
  $items['admin/modules/list'] = array(
717
    'title' => 'List',
718
719
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
720
  $items['admin/modules/list/confirm'] = array(
721
    'title' => 'List',
722
    'route_name' => 'system_modules_list_confirm',
723
    'type' => MENU_VISIBLE_IN_BREADCRUMB,
724
  );
725
  $items['admin/modules/uninstall'] = array(
726
    'title' => 'Uninstall',
727
    'route_name' => 'system_modules_uninstall',