Newer
Older
/**
* @file
* Configuration system that lets administrators modify the workings of the site.
*/
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Language\Language;
use Drupal\Core\Utility\ModuleInfo;
use Drupal\block\BlockPluginInterface;
use Drupal\menu_link\MenuLinkInterface;
use Drupal\user\UserInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Guzzle\Http\Exception\BadResponseException;
use Guzzle\Http\Exception\RequestException;
/**
* Maximum age of temporary files in seconds.
*/
const DRUPAL_MAXIMUM_TEMP_FILE_AGE = 21600;
Angie Byron
committed
/**
* New users will be set to the default time zone at registration.
*/
const DRUPAL_USER_TIMEZONE_DEFAULT = 0;
Angie Byron
committed
/**
* New users will get an empty time zone at registration.
*/
const DRUPAL_USER_TIMEZONE_EMPTY = 1;
Angie Byron
committed
/**
* New users will select their own timezone at registration.
*/
const DRUPAL_USER_TIMEZONE_SELECT = 2;
Angie Byron
committed
Dries Buytaert
committed
/**
* Disabled option on forms and settings
*/
const DRUPAL_DISABLED = 0;
Dries Buytaert
committed
/**
* Optional option on forms and settings
*/
const DRUPAL_OPTIONAL = 1;
Dries Buytaert
committed
/**
* Required option on forms and settings
*/
const DRUPAL_REQUIRED = 2;
Dries Buytaert
committed
Dries Buytaert
committed
/**
* Return only visible regions.
Dries Buytaert
committed
*
* @see system_region_list()
Dries Buytaert
committed
*/
const REGIONS_VISIBLE = 'visible';
Dries Buytaert
committed
/**
* Return all regions.
Dries Buytaert
committed
*
* @see system_region_list()
Dries Buytaert
committed
*/
const REGIONS_ALL = 'all';
Dries Buytaert
committed
Alex Pott
committed
/**
* Defines the max length for an email address
*
* The maximum length of an e-mail address is 254 characters. RFC 3696
* specifies a total length of 320 characters, but mentions that
* addresses longer than 256 characters are not normally useful. Erratum
* 1690 was then released which corrected this value to 254 characters.
* @see http://tools.ietf.org/html/rfc3696#section-3
* @see http://www.rfc-editor.org/errata_search.php?rfc=3696&eid=1690
*/
const EMAIL_MAX_LENGTH = 254;
Dries Buytaert
committed
* Implements hook_help().
Gábor Hojtsy
committed
function system_help($path, $arg) {
Gábor Hojtsy
committed
switch ($path) {
Dries Buytaert
committed
case 'admin/help#system':
Dries Buytaert
committed
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$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>';
Dries Buytaert
committed
$output .= '<h3>' . t('Uses') . '</h3>';
$output .= '<dl>';
$output .= '<dt>' . t('Managing modules') . '</dt>';
Angie Byron
committed
$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>';
Dries Buytaert
committed
$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>';
$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>';
Dries Buytaert
committed
$output .= '<dt>' . t('Configuring basic site settings') . '</dt>';
Dries Buytaert
committed
$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>';
Dries Buytaert
committed
$output .= '</dl>';
Dries Buytaert
committed
return $output;
case 'admin/index':
return '<p>' . t('This page shows you all available administration tasks for each module.') . '</p>';
Dries Buytaert
committed
case 'admin/appearance':
Angie Byron
committed
$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>';
return $output;
case 'admin/appearance/settings/' . $arg[3]:
Dries Buytaert
committed
$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>';
Dries Buytaert
committed
case 'admin/appearance/settings':
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>';
Angie Byron
committed
case 'admin/modules':
$output = '<p>' . t('Download additional <a href="@modules">contributed modules</a> to extend Drupal\'s functionality.', array('@modules' => 'http://drupal.org/project/modules')) . '</p>';
if (\Drupal::moduleHandler()->moduleExists('update')) {
Dries Buytaert
committed
if (update_manager_access()) {
Nate Lampton
committed
$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>';
Dries Buytaert
committed
}
else {
Nate Lampton
committed
$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>';
Dries Buytaert
committed
}
}
else {
$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>';
Dries Buytaert
committed
}
Dries Buytaert
committed
return $output;
Angie Byron
committed
case 'admin/modules/uninstall':
Dries Buytaert
committed
return '<p>' . t('The uninstall process removes all data related to a module.') . '</p>';
Angie Byron
committed
case 'admin/structure/block/manage':
if ($arg[4] == 'system' && $arg[5] == 'powered-by') {
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>';
Gábor Hojtsy
committed
}
Gábor Hojtsy
committed
break;
case 'admin/config/development/maintenance':
if (\Drupal::currentUser()->id() == 1) {
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>';
Dries Buytaert
committed
}
Angie Byron
committed
break;
case 'admin/reports/status':
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>';
Dries Buytaert
committed
}
/**
Dries Buytaert
committed
* Implements hook_theme().
*/
Dries Buytaert
committed
function system_theme() {
return array_merge(drupal_common_theme(), array(
Dries Buytaert
committed
'system_themes_page' => array(
'variables' => array(
'theme_groups' => NULL,
'theme_group_titles' => NULL,
),
'file' => 'system.admin.inc',
Dries Buytaert
committed
),
'system_config_form' => array(
'render element' => 'form',
Dries Buytaert
committed
),
'confirm_form' => array(
'render element' => 'form',
Dries Buytaert
committed
),
'system_modules_details' => array(
'render element' => 'form',
'file' => 'system.admin.inc',
Dries Buytaert
committed
),
'system_modules_incompatible' => array(
'variables' => array('message' => NULL),
'file' => 'system.admin.inc',
Dries Buytaert
committed
'system_modules_uninstall' => array(
'render element' => 'form',
'file' => 'system.admin.inc',
Dries Buytaert
committed
),
'status_report' => array(
'variables' => array('requirements' => NULL),
'file' => 'system.admin.inc',
Angie Byron
committed
'template' => 'status-report',
Dries Buytaert
committed
),
'admin_page' => array(
'variables' => array('blocks' => NULL),
'file' => 'system.admin.inc',
Dries Buytaert
committed
),
'admin_block' => array(
'variables' => array('block' => NULL),
'file' => 'system.admin.inc',
Dries Buytaert
committed
),
'admin_block_content' => array(
'variables' => array('content' => NULL),
'file' => 'system.admin.inc',
'template' => 'admin-block-content',
Dries Buytaert
committed
),
'system_admin_index' => array(
'variables' => array('menu_items' => NULL),
'file' => 'system.admin.inc',
Dries Buytaert
committed
),
'system_compact_link' => array(
'variables' => array(),
Dries Buytaert
committed
),
Dries Buytaert
committed
));
}
Dries Buytaert
committed
* Implements hook_permission().
function system_permission() {
return array(
Dries Buytaert
committed
'administer modules' => array(
'title' => t('Administer modules'),
),
Angie Byron
committed
'administer site configuration' => array(
'title' => t('Administer site configuration'),
Dries Buytaert
committed
'restrict access' => TRUE,
Angie Byron
committed
),
Dries Buytaert
committed
'administer themes' => array(
'title' => t('Administer themes'),
),
'administer software updates' => array(
Dries Buytaert
committed
'title' => t('Administer software updates'),
'restrict access' => TRUE,
),
Angie Byron
committed
'access administration pages' => array(
'title' => t('Use the administration pages and help'),
Angie Byron
committed
),
'access site in maintenance mode' => array(
'title' => t('Use the site in maintenance mode'),
Dries Buytaert
committed
'view the administration theme' => array(
'title' => t('View the administration theme'),
Dries Buytaert
committed
'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'))),
Dries Buytaert
committed
),
Angie Byron
committed
'access site reports' => array(
'title' => t('View site reports'),
Angie Byron
committed
),
);
Dries Buytaert
committed
* Implements hook_hook_info().
*/
function system_hook_info() {
$hooks['token_info'] = array(
'group' => 'tokens',
);
$hooks['token_info_alter'] = array(
'group' => 'tokens',
);
$hooks['tokens'] = array(
'group' => 'tokens',
);
Angie Byron
committed
$hooks['tokens_alter'] = array(
'group' => 'tokens',
);
return $hooks;
}
Dries Buytaert
committed
* Implements hook_element_info().
Dries Buytaert
committed
function system_element_info() {
// Top level elements.
$types['form'] = array(
Dries Buytaert
committed
'#method' => 'post',
'#action' => request_uri(),
'#theme_wrappers' => array('form'),
Dries Buytaert
committed
);
Dries Buytaert
committed
$types['page'] = array(
'#show_messages' => TRUE,
'#theme' => 'page',
);
// By default, we don't want Ajax commands being rendered in the context of an
Dries Buytaert
committed
// 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
// debugging page that displays rather than executes Ajax commands).
Dries Buytaert
committed
$types['ajax'] = array(
'#header' => TRUE,
'#commands' => array(),
'#error' => NULL,
Dries Buytaert
committed
);
$types['html_tag'] = array(
catch
committed
'#pre_render' => array('drupal_pre_render_conditional_comments', 'drupal_pre_render_html_tag'),
'#attributes' => array(),
'#value' => NULL,
);
Dries Buytaert
committed
$types['styles'] = array(
'#items' => array(),
'#pre_render' => array('drupal_pre_render_styles'),
);
$types['scripts'] = array(
'#items' => array(),
'#pre_render' => array('drupal_pre_render_scripts'),
);
Dries Buytaert
committed
// Input elements.
$types['submit'] = array(
Dries Buytaert
committed
'#input' => TRUE,
'#name' => 'op',
Angie Byron
committed
'#is_button' => TRUE,
Dries Buytaert
committed
'#executes_submit_callback' => TRUE,
'#limit_validation_errors' => FALSE,
'#process' => array('form_process_button', 'ajax_process_form'),
'#pre_render' => array('form_pre_render_button'),
'#theme_wrappers' => array('input__submit'),
Dries Buytaert
committed
);
Dries Buytaert
committed
$types['button'] = array(
Dries Buytaert
committed
'#input' => TRUE,
'#name' => 'op',
Angie Byron
committed
'#is_button' => TRUE,
Dries Buytaert
committed
'#executes_submit_callback' => FALSE,
'#limit_validation_errors' => FALSE,
'#process' => array('form_process_button', 'ajax_process_form'),
'#pre_render' => array('form_pre_render_button'),
'#theme_wrappers' => array('input__button'),
Dries Buytaert
committed
);
Dries Buytaert
committed
$types['image_button'] = array(
Dries Buytaert
committed
'#input' => TRUE,
Angie Byron
committed
'#is_button' => TRUE,
Dries Buytaert
committed
'#executes_submit_callback' => TRUE,
'#limit_validation_errors' => FALSE,
'#process' => array('form_process_button', 'ajax_process_form'),
Dries Buytaert
committed
'#return_value' => TRUE,
'#has_garbage_value' => TRUE,
'#src' => NULL,
'#pre_render' => array('form_pre_render_image_button'),
'#theme_wrappers' => array('input__image_button'),
Dries Buytaert
committed
);
Dries Buytaert
committed
$types['textfield'] = array(
Dries Buytaert
committed
'#input' => TRUE,
'#size' => 60,
'#maxlength' => 128,
catch
committed
'#autocomplete_route_name' => FALSE,
Angie Byron
committed
'#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern', 'form_process_group'),
'#pre_render' => array('form_pre_render_textfield', 'form_pre_render_group'),
'#theme' => 'input__textfield',
'#theme_wrappers' => array('form_element'),
Dries Buytaert
committed
);
$types['tel'] = array(
'#input' => TRUE,
'#size' => 30,
'#maxlength' => 128,
catch
committed
'#autocomplete_route_name' => FALSE,
'#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern'),
'#pre_render' => array('form_pre_render_tel'),
'#theme' => 'input__tel',
'#theme_wrappers' => array('form_element'),
);
catch
committed
$types['email'] = array(
'#input' => TRUE,
'#size' => 60,
Alex Pott
committed
'#maxlength' => EMAIL_MAX_LENGTH,
catch
committed
'#autocomplete_route_name' => FALSE,
'#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern'),
catch
committed
'#element_validate' => array('form_validate_email'),
'#pre_render' => array('form_pre_render_email'),
'#theme' => 'input__email',
catch
committed
'#theme_wrappers' => array('form_element'),
);
catch
committed
$types['url'] = array(
'#input' => TRUE,
'#size' => 60,
'#maxlength' => 255,
catch
committed
'#autocomplete_route_name' => FALSE,
'#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern'),
catch
committed
'#element_validate' => array('form_validate_url'),
'#pre_render' => array('form_pre_render_url'),
'#theme' => 'input__url',
catch
committed
'#theme_wrappers' => array('form_element'),
);
catch
committed
$types['search'] = array(
'#input' => TRUE,
'#size' => 60,
'#maxlength' => 128,
catch
committed
'#autocomplete_route_name' => FALSE,
'#process' => array('form_process_autocomplete', 'ajax_process_form'),
'#pre_render' => array('form_pre_render_search'),
'#theme' => 'input__search',
catch
committed
'#theme_wrappers' => array('form_element'),
);
$types['number'] = array(
'#input' => TRUE,
'#step' => 1,
'#process' => array('ajax_process_form'),
'#element_validate' => array('form_validate_number'),
'#pre_render' => array('form_pre_render_number'),
'#theme' => 'input__number',
'#theme_wrappers' => array('form_element'),
);
catch
committed
$types['range'] = array(
'#input' => TRUE,
'#step' => 1,
'#min' => 0,
'#max' => 100,
'#process' => array('ajax_process_form'),
'#element_validate' => array('form_validate_number'),
'#pre_render' => array('form_pre_render_range'),
'#theme' => 'input__range',
catch
committed
'#theme_wrappers' => array('form_element'),
);
Angie Byron
committed
$types['color'] = array(
'#input' => TRUE,
'#process' => array('ajax_process_form'),
'#element_validate' => array('form_validate_color'),
'#pre_render' => array('form_pre_render_color'),
'#theme' => 'input__color',
Angie Byron
committed
'#theme_wrappers' => array('form_element'),
);
Dries Buytaert
committed
$types['machine_name'] = array(
'#input' => TRUE,
'#default_value' => NULL,
'#required' => TRUE,
'#maxlength' => 64,
'#size' => 60,
catch
committed
'#autocomplete_route_name' => FALSE,
Dries Buytaert
committed
'#process' => array('form_process_machine_name', 'form_process_autocomplete', 'ajax_process_form'),
Dries Buytaert
committed
'#element_validate' => array('form_validate_machine_name'),
'#pre_render' => array('form_pre_render_textfield'),
'#theme' => 'input__textfield',
Dries Buytaert
committed
'#theme_wrappers' => array('form_element'),
);
Dries Buytaert
committed
$types['password'] = array(
Dries Buytaert
committed
'#input' => TRUE,
'#size' => 60,
'#maxlength' => 128,
'#process' => array('ajax_process_form', 'form_process_pattern'),
'#pre_render' => array('form_pre_render_password'),
'#theme' => 'input__password',
'#theme_wrappers' => array('form_element'),
Dries Buytaert
committed
);
Dries Buytaert
committed
$types['password_confirm'] = array(
Dries Buytaert
committed
'#input' => TRUE,
'#process' => array('form_process_password_confirm', 'user_form_process_password_confirm'),
'#theme_wrappers' => array('form_element'),
Dries Buytaert
committed
);
Dries Buytaert
committed
$types['textarea'] = array(
Dries Buytaert
committed
'#input' => TRUE,
'#cols' => 60,
'#rows' => 5,
catch
committed
'#resizable' => 'vertical',
Angie Byron
committed
'#process' => array('ajax_process_form', 'form_process_group'),
'#pre_render' => array('form_pre_render_group'),
'#theme' => 'textarea',
'#theme_wrappers' => array('form_element'),
Dries Buytaert
committed
);
Dries Buytaert
committed
$types['radios'] = array(
Dries Buytaert
committed
'#input' => TRUE,
'#process' => array('form_process_radios'),
'#theme_wrappers' => array('radios'),
'#pre_render' => array('form_pre_render_conditional_form_element'),
Dries Buytaert
committed
);
Dries Buytaert
committed
$types['radio'] = array(
Dries Buytaert
committed
'#input' => TRUE,
'#default_value' => NULL,
Angie Byron
committed
'#process' => array('ajax_process_form'),
'#pre_render' => array('form_pre_render_radio'),
'#theme' => 'input__radio',
'#theme_wrappers' => array('form_element'),
Dries Buytaert
committed
'#title_display' => 'after',
Dries Buytaert
committed
);
Dries Buytaert
committed
$types['checkboxes'] = array(
Dries Buytaert
committed
'#input' => TRUE,
'#process' => array('form_process_checkboxes'),
'#pre_render' => array('form_pre_render_conditional_form_element'),
'#theme_wrappers' => array('checkboxes'),
Dries Buytaert
committed
);
Dries Buytaert
committed
$types['checkbox'] = array(
Dries Buytaert
committed
'#input' => TRUE,
'#return_value' => 1,
Angie Byron
committed
'#process' => array('form_process_checkbox', 'ajax_process_form', 'form_process_group'),
'#pre_render' => array('form_pre_render_checkbox', 'form_pre_render_group'),
'#theme' => 'input__checkbox',
'#theme_wrappers' => array('form_element'),
Dries Buytaert
committed
'#title_display' => 'after',
Dries Buytaert
committed
);
Dries Buytaert
committed
$types['select'] = array(
Dries Buytaert
committed
'#input' => TRUE,
'#multiple' => FALSE,
Dries Buytaert
committed
'#process' => array('form_process_select', 'ajax_process_form'),
'#theme' => 'select',
'#theme_wrappers' => array('form_element'),
'#options' => array(),
Dries Buytaert
committed
);
$types['language_select'] = array(
'#input' => TRUE,
'#default_value' => Language::LANGCODE_NOT_SPECIFIED,
);
Dries Buytaert
committed
$types['weight'] = array(
Dries Buytaert
committed
'#input' => TRUE,
'#delta' => 10,
'#default_value' => 0,
Angie Byron
committed
'#process' => array('form_process_weight', 'ajax_process_form'),
Dries Buytaert
committed
);
Dries Buytaert
committed
$types['date'] = array(
Dries Buytaert
committed
'#input' => TRUE,
'#theme' => 'date',
'#theme_wrappers' => array('form_element'),
Dries Buytaert
committed
);
Dries Buytaert
committed
$types['file'] = array(
Dries Buytaert
committed
'#input' => TRUE,
Angie Byron
committed
'#multiple' => FALSE,
'#process' => array('form_process_file'),
Dries Buytaert
committed
'#size' => 60,
'#pre_render' => array('form_pre_render_file'),
'#theme' => 'input__file',
'#theme_wrappers' => array('form_element'),
Dries Buytaert
committed
);
Dries Buytaert
committed
$types['tableselect'] = array(
Angie Byron
committed
'#input' => TRUE,
'#js_select' => TRUE,
'#multiple' => TRUE,
'#process' => array('form_process_tableselect'),
'#options' => array(),
'#empty' => '',
Dries Buytaert
committed
'#theme' => 'tableselect',
Angie Byron
committed
);
Dries Buytaert
committed
Dries Buytaert
committed
// Form structure.
$types['item'] = array(
Dries Buytaert
committed
// 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,
'#markup' => '',
'#theme_wrappers' => array('form_element'),
Dries Buytaert
committed
);
Dries Buytaert
committed
$types['hidden'] = array(
Dries Buytaert
committed
'#input' => TRUE,
Angie Byron
committed
'#process' => array('ajax_process_form'),
'#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',
Dries Buytaert
committed
);
Dries Buytaert
committed
$types['value'] = array(
Dries Buytaert
committed
'#input' => TRUE,
);
$types['link'] = array(
'#pre_render' => array('drupal_pre_render_link'),
Dries Buytaert
committed
);
Dries Buytaert
committed
$types['fieldset'] = array(
'#value' => NULL,
Angie Byron
committed
'#process' => array('form_process_group', 'ajax_process_form'),
'#pre_render' => array('form_pre_render_group'),
'#theme_wrappers' => array('fieldset'),
);
$types['fieldgroup'] = $types['fieldset'] + array(
'#attributes' => array('class' => array('fieldgroup')),
);
$types['details'] = array(
Angie Byron
committed
'#open' => FALSE,
Dries Buytaert
committed
'#value' => NULL,
Angie Byron
committed
'#process' => array('form_process_group', 'ajax_process_form'),
'#pre_render' => array('form_pre_render_details', 'form_pre_render_group'),
'#theme_wrappers' => array('details'),
Dries Buytaert
committed
);
Dries Buytaert
committed
$types['vertical_tabs'] = array(
'#default_tab' => '',
'#process' => array('form_process_vertical_tabs'),
Angie Byron
committed
'#pre_render' => array('form_pre_render_vertical_tabs'),
'#theme_wrappers' => array('vertical_tabs', 'form_element'),
);
Angie Byron
committed
$types['dropbutton'] = array(
'#pre_render' => array('drupal_pre_render_dropbutton'),
'#theme' => 'links__dropbutton',
Angie Byron
committed
);
$types['operations'] = array(
'#pre_render' => array('drupal_pre_render_dropbutton'),
'#theme' => 'links__dropbutton__operations',
Angie Byron
committed
);
Dries Buytaert
committed
$types['container'] = array(
Angie Byron
committed
'#process' => array('form_process_group', 'form_process_container'),
'#pre_render' => array('form_pre_render_group'),
'#theme_wrappers' => array('container'),
Dries Buytaert
committed
);
Dries Buytaert
committed
$types['actions'] = array(
Angie Byron
committed
'#process' => array('form_pre_render_actions_dropbutton', 'form_process_actions', 'form_process_container'),
Dries Buytaert
committed
'#weight' => 100,
'#theme_wrappers' => array('container'),
Dries Buytaert
committed
);
$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_attach_tabledrag(). drupal_pre_render_table() prepends the HTML ID
// of the table to each set of options.
// @see drupal_attach_tabledrag()
'#tabledrag' => array(),
// Render properties.
'#pre_render' => array('drupal_pre_render_table'),
'#theme' => 'table',
);
// Other elements.
$types['render_cache_placeholder'] = array(
'#callback' => '',
'#context' => array(),
'#pre_render' => array('drupal_pre_render_render_cache_placeholder'),
);
Dries Buytaert
committed
return $types;
Dries Buytaert
committed
* Implements hook_menu().
Dries Buytaert
committed
function system_menu() {
$items['admin'] = array(
'title' => 'Administration',
'route_name' => 'system.admin',
Dries Buytaert
committed
'weight' => 9,
Dries Buytaert
committed
'menu_name' => 'admin',
Dries Buytaert
committed
);
Gábor Hojtsy
committed
// Menu items that are basically just menu blocks.
Dries Buytaert
committed
$items['admin/structure'] = array(
'title' => 'Structure',
Angie Byron
committed
'description' => 'Administer blocks, content types, menus, etc.',
Dries Buytaert
committed
'position' => 'right',
'weight' => -8,
'route_name' => 'system.admin_structure',
Dries Buytaert
committed
);
Dries Buytaert
committed
// Appearance.
$items['admin/appearance'] = array(
'title' => 'Appearance',
'description' => 'Select and configure your themes.',
Angie Byron
committed
'route_name' => 'system.themes_page',
Angie Byron
committed
'position' => 'left',
'weight' => -6,
Dries Buytaert
committed
);
Angie Byron
committed
// Modules.
Angie Byron
committed
$items['admin/modules'] = array(
'title' => 'Extend',
'description' => 'Add and enable modules to extend site functionality.',
'route_name' => 'system.modules_list',
Dries Buytaert
committed
);
Angie Byron
committed
// Configuration.
$items['admin/config'] = array(
'title' => 'Configuration',
'description' => 'Administer settings.',
'route_name' => 'system.admin_config',
Gábor Hojtsy
committed
);
Dries Buytaert
committed
$items['admin/config/media'] = array(
'title' => 'Media',
'description' => 'Media tools.',
'position' => 'left',
Angie Byron
committed
'weight' => -10,
'route_name' => 'system.admin_config_media',
Dries Buytaert
committed
);
$items['admin/config/media/file-system'] = array(
Dries Buytaert
committed
'title' => 'File system',
Dries Buytaert
committed
'description' => 'Tell Drupal where to store uploaded files and how they are accessed.',
'route_name' => 'system.file_system_settings',
Angie Byron
committed
'weight' => -10,
Dries Buytaert
committed
);
$items['admin/config/media/image-toolkit'] = array(
Dries Buytaert
committed
'title' => 'Image toolkit',
'description' => 'Choose which image toolkit to use if you have installed optional toolkits.',
'route_name' => 'system.image_toolkit_settings',
Dries Buytaert
committed
'weight' => 20,
);
Angie Byron
committed
$items['admin/config/services'] = array(
'title' => 'Web services',
'description' => 'Tools related to web services.',
Angie Byron
committed
'position' => 'right',
'weight' => 0,
'route_name' => 'system.admin_config_services',
Angie Byron
committed
);
$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.',
'route_name' => 'system.rss_feeds_settings',
// Development settings.
$items['admin/config/development'] = array(
'title' => 'Development',
'description' => 'Development tools.',
Angie Byron
committed
'position' => 'right',
'weight' => -10,
'route_name' => 'system.admin_config_development',
);
$items['admin/config/development/maintenance'] = array(
'title' => 'Maintenance mode',
'description' => 'Take the site offline for maintenance or bring it back online.',
'route_name' => 'system.site_maintenance_mode',
Angie Byron
committed
'weight' => -10,
);
$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.',
'route_name' => 'system.performance_settings',
Angie Byron
committed
'weight' => -20,
Angie Byron
committed
$items['admin/config/development/logging'] = array(
Dries Buytaert
committed
'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.",
'route_name' => 'system.logging_settings',
Angie Byron
committed
'weight' => -15,
Dries Buytaert
committed
);
Dries Buytaert
committed
// Regional and date settings.
Dries Buytaert
committed
$items['admin/config/regional'] = array(
'title' => 'Regional and language',
'description' => 'Regional settings, localization and translation.',
'position' => 'left',
Angie Byron
committed
'weight' => -5,
'route_name' => 'system.admin_config_regional',
Dries Buytaert
committed
);
$items['admin/config/regional/settings'] = array(
'title' => 'Regional settings',
Dries Buytaert
committed
'description' => "Settings for the site's default time zone and country.",
'route_name' => 'system.regional_settings',
Angie Byron
committed
'weight' => -20,
Dries Buytaert
committed
);
Dries Buytaert
committed
$items['admin/config/regional/date-time'] = array(
Alex Pott
committed
'title' => 'Date and time formats',
Dries Buytaert
committed
'description' => 'Configure display format strings for date and time.',
'route_name' => 'system.date_format_list',
Angie Byron
committed
'weight' => -5,
Dries Buytaert
committed
);
Alex Pott
committed
$items['admin/config/regional/date-time/formats/manage/%'] = array(
Dries Buytaert
committed
'title' => 'Edit date format',
'description' => 'Allow users to edit a configured date format.',
'route_name' => 'system.date_format_edit',
Dries Buytaert
committed
);
Angie Byron
committed
$items['admin/config/search'] = array(
'title' => 'Search and metadata',
'description' => 'Local site search, metadata and SEO.',
Angie Byron
committed
'position' => 'left',
'weight' => -10,
'route_name' => 'system.admin_config_search',
Angie Byron
committed
);
Angie Byron
committed
$items['admin/config/system'] = array(
'title' => 'System',
'description' => 'General system related configuration.',
'position' => 'right',
Angie Byron
committed
'weight' => -20,
'route_name' => 'system.admin_config_system',
Angie Byron
committed
);
$items['admin/config/system/site-information'] = array(
Dries Buytaert
committed
'title' => 'Site information',
'description' => 'Change site name, e-mail address, slogan, default front page and error pages.',
'route_name' => 'system.site_information_settings',
Angie Byron
committed
'weight' => -20,
Dries Buytaert
committed
);
$items['admin/config/system/cron'] = array(
catch
committed
'title' => 'Cron',
'description' => 'Manage automatic site maintenance tasks.',
'route_name' => 'system.cron_settings',
'weight' => 20,
);
// Additional categories
$items['admin/config/user-interface'] = array(
'title' => 'User interface',
'description' => 'Tools that enhance the user interface.',
'position' => 'right',
'route_name' => 'system.admin_config_ui',
Angie Byron
committed
'weight' => -15,
$items['admin/config/workflow'] = array(
'title' => 'Workflow',
'description' => 'Content workflow, editorial workflow tools.',
Angie Byron
committed
'position' => 'right',
'weight' => 5,
'route_name' => 'system.admin_config_workflow',
);
$items['admin/config/content'] = array(
'title' => 'Content authoring',
'description' => 'Settings related to formatting and authoring content.',
Angie Byron
committed
'position' => 'left',
'weight' => -15,
'route_name' => 'system.admin_config_content',
Dries Buytaert
committed
// Reports.
$items['admin/reports'] = array(
'title' => 'Reports',
'description' => 'View reports, updates, and errors.',
'route_name' => 'system.admin_reports',
Dries Buytaert
committed
'weight' => 5,
'position' => 'left',
);
$items['admin/reports/status'] = array(
'title' => 'Status report',
'description' => "Get a status report about your site's operation and any detected problems.",
'route_name' => 'system.status',
Dries Buytaert
committed
);
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Implements hook_menu_link_defaults().
*/
function system_menu_link_defaults() {
$items['system.admin'] = array(
'link_title' => 'Administration',
'route_name' => 'system.admin',
'weight' => 9,
'menu_name' => 'admin',
);
// Menu items that are basically just menu blocks.
$items['system.admin.structure'] = array(
'route_name' => 'system.admin_structure',
'parent' => 'system.admin',
'description' => 'Administer blocks, content types, menus, etc.',
'link_title' => 'Structure',
'weight' => -8,
);
// Appearance.
$items['system.admin.appearance'] = array(
'route_name' => 'system.themes_page',
'link_title' => 'Appearance',
'parent' => 'system.admin',
'weight' => -6,
);
// Modules.
$items['system.admin.modules'] = array(
'link_title' => 'Extend',
'parent' => 'system.admin',
'route_name' => 'system.modules_list',
'weight' => -2,
);
// Configuration.
$items['system.admin.config'] = array(
'link_title' => 'Configuration',
'parent' => 'system.admin',
'description' => 'Administer settings.',
'route_name' => 'system.admin_config',
'weight' => 0,
);
// Media settings.
$items['system.admin.config.media'] = array(
'route_name' => 'system.admin_config_media',
'parent' => 'system.admin.config',
'link_title' => 'Media',
'weight' => -10,
);
$items['system.admin.config.media.file-system'] = array(
'link_title' => 'File system',
'description' => 'Tell Drupal where to store uploaded files and how they are accessed.',
'parent' => 'system.admin.config.media',
'route_name' => 'system.file_system_settings',
);
$items['system.admin.config.media.image-toolkit'] = array(
'link_title' => 'Image toolkit',
'parent' => 'system.admin.config.media',
'route_name' => 'system.image_toolkit_settings',
'description' => 'Choose which image toolkit to use if you have installed optional toolkits.',
'weight' => 20,
);
// Service settings.
$items['system.admin.config.services'] = array(
'link_title' => 'Web services',
'parent' => 'system.admin.config',
'route_name' => 'system.admin_config_services',
);
$items['system.admin.config.services.rss-publishing'] = array(
'link_title' => 'RSS publishing',
'parent' => 'system.admin.config.services',
'description' => 'Configure the site description, the number of items per feed and whether feeds should be titles/teasers/full-text.',
'route_name' => 'system.rss_feeds_settings',
);
// Development settings.
$items['system.admin.config.development'] = array(
'route_name' => 'system.admin_config_development',
'parent' => 'system.admin.config',
'link_title' => 'Development',
'description' => 'Development tools.',
'weight' => -10,
);
$items['system.admin.config.development.maintenance'] = array(
'link_title' => 'Maintenance mode',
'parent' => 'system.admin.config.development',
'description' => 'Take the site offline for maintenance or bring it back online.',
'route_name' => 'system.site_maintenance_mode',
'weight' => -10,
);
$items['system.admin.config.development.performance'] = array(
'link_title' => 'Performance',
'parent' => 'system.admin.config.development',
'description' => 'Enable or disable page caching for anonymous users and set CSS and JS bandwidth optimization options.',
'route_name' => 'system.performance_settings',
'weight' => -20,
);
$items['system.admin.config.development.logging'] = array(
'link_title' => 'Logging and errors',
'parent' => 'system.admin.config.development',
'description' => "Settings for logging and alerts modules. Various modules can route Drupal's system events to different destinations, such as syslog, database, email, etc.",
'route_name' => 'system.logging_settings',
'weight' => -15,
);
// Regional and date settings.
$items['system.admin.config.regional'] = array(
'route_name' => 'system.admin_config_regional',
'link_title' => 'Regional and language',
'parent' => 'system.admin.config',
'description' => 'Regional settings, localization and translation.',
'weight' => -5,
);
$items['system.admin.config.regional.settings'] = array(
'link_title' => 'Regional settings',
'parent' => 'system.admin.config.regional',
'description' => "Settings for the site's default time zone and country.",
'route_name' => 'system.regional_settings',
'weight' => -20,
);
$items['system.admin.config.regional.date-time'] = array(
'link_title' => 'Date and time formats',
'parent' => 'system.admin.config.regional',
'description' => 'Configure display format strings for date and time.',
'route_name' => 'system.date_format_list',
'weight' => -9,
);
// Search settings.
$items['system.admin.config.search'] = array(
'link_title' => 'Search and metadata',
'route_name' => 'system.admin_config_search',
'parent' => 'system.admin.config',
'description' => 'Local site search, metadata and SEO.',
'weight' => -10,
);
// System settings.
$items['system.admin.config.system'] = array(
'link_title' => 'System',
'route_name' => 'system.admin_config_system',
'parent' => 'system.admin.config',
'description' => 'General system related configuration.',
'weight' => -20,
);
$items['system.admin.config.system.site-information'] = array(
'link_title' => 'Site information',
'parent' => 'system.admin.config.system',
'description' => 'Change site name, e-mail address, slogan, default front page, and number of posts per page, error pages.',
'route_name' => 'system.site_information_settings',
'weight' => -20,
);
$items['system.admin.config.system.cron'] = array(
'link_title' => 'Cron',
'parent' => 'system.admin.config.system',
'description' => 'Manage automatic site maintenance tasks.',
'route_name' => 'system.cron_settings',
'weight' => 20,
);
// Additional categories
$items['system.admin.config.user-interface'] = array(
'link_title' => 'User interface',
'route_name' => 'system.admin_config_ui',
'parent' => 'system.admin.config',
'description' => 'Tools that enhance the user interface.',
'weight' => -15,
);
$items['system.admin.config.workflow'] = array(
'link_title' => 'Workflow',
'route_name' => 'system.admin_config_workflow',
'parent' => 'system.admin.config',
'description' => 'Content workflow, editorial workflow tools.',
'weight' => 5,
);