system.module 149 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
use Drupal\Core\Utility\ModuleInfo;
9
use Symfony\Component\HttpFoundation\JsonResponse;
10 11
use Symfony\Component\HttpFoundation\Response;

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

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

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

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

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

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

/**
 * Required option on forms and settings
 */
45
const DRUPAL_REQUIRED = 2;
46

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

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 .= '<dt>' . t('Configuring actions') . '</dt>';
92
      $output .= '<dd>' . t('Actions are individual tasks that the system can do, such as unpublishing a piece of content or banning a user. Other modules can fire these actions when certain system events happen; for example, when a new post is added or when a user logs in. Modules may also provide additional actions. Visit the <a href="@actions">Actions page</a> to configure actions.', array('@actions' => url('admin/config/system/actions'))) . '</dd>';
93
      $output .= '</dl>';
94
      return $output;
95
    case 'admin/index':
96
      return '<p>' . t('This page shows you all available administration tasks for each module.') . '</p>';
97
    case 'admin/appearance':
98
      $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>';
99
      return $output;
100
    case 'admin/appearance/settings/' . $arg[3]:
101 102 103
      $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>';
104
    case 'admin/appearance/settings':
105
      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>';
106
    case 'admin/modules':
107
      $output = '<p>' . t('Download additional <a href="@modules">contributed modules</a> to extend Drupal\'s functionality.', array('@modules' => 'http://drupal.org/project/modules')) . '</p>';
108 109
      if (module_exists('update')) {
        if (update_manager_access()) {
110
          $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>';
111 112
        }
        else {
113
          $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>';
114 115 116
        }
      }
      else {
117
        $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>';
118
      }
119
      return $output;
120
    case 'admin/modules/uninstall':
121
      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>';
122
    case 'admin/structure/block/manage':
123
      if ($arg[4] == 'system' && $arg[5] == 'powered-by') {
124
        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>';
125
      }
126
      break;
127
    case 'admin/config/development/maintenance':
128 129
      global $user;
      if ($user->uid == 1) {
130
        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>';
131
      }
132
      break;
133 134
    case 'admin/config/system/actions':
    case 'admin/config/system/actions/manage':
135
      $output = '';
136
      $output .= '<p>' . t('There are two types of actions: simple and advanced. Simple actions do not require any additional configuration and are listed here automatically. Advanced actions need to be created and configured before they can be used because they have options that need to be specified; for example, sending an e-mail to a specified address or unpublishing content containing certain words. To create an advanced action, select the action from the drop-down list in the advanced action section below and click the <em>Create</em> button.') . '</p>';
137
      return $output;
138
    case 'admin/config/system/actions/configure':
139
      return t('An advanced action offers additional configuration options which may be filled out below. Changing the <em>Description</em> field is recommended in order to better identify the precise action taking place.');
140
    case 'admin/config/people/ip-blocking':
141
      return '<p>' . t('IP addresses listed here are blocked from your site. Blocked addresses are completely forbidden from accessing the site and instead see a brief message explaining the situation.') . '</p>';
142
    case 'admin/reports/status':
143
      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>';
144
  }
Dries's avatar
 
Dries committed
145 146
}

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

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

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

268 269 270
  return $hooks;
}

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

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

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

535 536
  // Form structure.
  $types['item'] = array(
537
    '#markup' => '',
538
    '#pre_render' => array('drupal_pre_render_markup'),
539
    '#theme_wrappers' => array('form_element'),
540
  );
541
  $types['hidden'] = array(
542
    '#input' => TRUE,
543
    '#process' => array('ajax_process_form'),
544
    '#theme' => 'hidden',
545
  );
546
  $types['value'] = array(
547 548
    '#input' => TRUE,
  );
549
  $types['markup'] = array(
550
    '#markup' => '',
551 552 553 554
    '#pre_render' => array('drupal_pre_render_markup'),
  );
  $types['link'] = array(
    '#pre_render' => array('drupal_pre_render_link', 'drupal_pre_render_markup'),
555
  );
556
  $types['fieldset'] = array(
557 558 559
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
    '#value' => NULL,
560
    '#process' => array('form_process_fieldset', 'ajax_process_form'),
561
    '#pre_render' => array('form_pre_render_fieldset'),
562
    '#theme_wrappers' => array('fieldset'),
563
  );
564
  $types['vertical_tabs'] = array(
565
    '#theme_wrappers' => array('vertical_tabs'),
566 567 568
    '#default_tab' => '',
    '#process' => array('form_process_vertical_tabs'),
  );
569 570 571 572 573

  $types['container'] = array(
    '#theme_wrappers' => array('container'),
    '#process' => array('form_process_container'),
  );
574 575 576 577 578
  $types['actions'] = array(
    '#theme_wrappers' => array('container'),
    '#process' => array('form_process_actions', 'form_process_container'),
    '#weight' => 100,
  );
579

580
  $types['token'] = array(
581
    '#input' => TRUE,
582
    '#theme' => 'hidden',
583 584
  );

585
  return $types;
586 587
}

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

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

723
  foreach (list_themes() as $key => $theme) {