3299 lines
113 KiB
Plaintext
3299 lines
113 KiB
Plaintext
<?php
|
|
|
|
/**
|
|
* @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\system\Plugin\Block\SystemMenuBlock;
|
|
use Drupal\user\UserInterface;
|
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Guzzle\Http\Exception\BadResponseException;
|
|
use Guzzle\Http\Exception\RequestException;
|
|
|
|
/**
|
|
* Maximum age of temporary files in seconds.
|
|
*/
|
|
const DRUPAL_MAXIMUM_TEMP_FILE_AGE = 21600;
|
|
|
|
/**
|
|
* New users will be set to the default time zone at registration.
|
|
*/
|
|
const DRUPAL_USER_TIMEZONE_DEFAULT = 0;
|
|
|
|
/**
|
|
* New users will get an empty time zone at registration.
|
|
*/
|
|
const DRUPAL_USER_TIMEZONE_EMPTY = 1;
|
|
|
|
/**
|
|
* New users will select their own timezone at registration.
|
|
*/
|
|
const DRUPAL_USER_TIMEZONE_SELECT = 2;
|
|
|
|
/**
|
|
* Disabled option on forms and settings
|
|
*/
|
|
const DRUPAL_DISABLED = 0;
|
|
|
|
/**
|
|
* Optional option on forms and settings
|
|
*/
|
|
const DRUPAL_OPTIONAL = 1;
|
|
|
|
/**
|
|
* Required option on forms and settings
|
|
*/
|
|
const DRUPAL_REQUIRED = 2;
|
|
|
|
/**
|
|
* Return only visible regions.
|
|
*
|
|
* @see system_region_list()
|
|
*/
|
|
const REGIONS_VISIBLE = 'visible';
|
|
|
|
/**
|
|
* Return all regions.
|
|
*
|
|
* @see system_region_list()
|
|
*/
|
|
const REGIONS_ALL = 'all';
|
|
|
|
/**
|
|
* Implements hook_help().
|
|
*/
|
|
function system_help($path, $arg) {
|
|
global $base_url;
|
|
|
|
switch ($path) {
|
|
case 'admin/help#system':
|
|
$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>';
|
|
$output .= '<h3>' . t('Uses') . '</h3>';
|
|
$output .= '<dl>';
|
|
$output .= '<dt>' . t('Managing modules') . '</dt>';
|
|
$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>';
|
|
$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>';
|
|
$output .= '<dt>' . t('Configuring basic site settings') . '</dt>';
|
|
$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>';
|
|
$output .= '</dl>';
|
|
return $output;
|
|
case 'admin/index':
|
|
return '<p>' . t('This page shows you all available administration tasks for each module.') . '</p>';
|
|
case 'admin/appearance':
|
|
$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]:
|
|
$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>';
|
|
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>';
|
|
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 (module_exists('update')) {
|
|
if (update_manager_access()) {
|
|
$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>';
|
|
}
|
|
else {
|
|
$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>';
|
|
}
|
|
}
|
|
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>';
|
|
}
|
|
return $output;
|
|
case 'admin/modules/uninstall':
|
|
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>';
|
|
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>';
|
|
}
|
|
break;
|
|
case 'admin/config/development/maintenance':
|
|
global $user;
|
|
if ($user->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>';
|
|
}
|
|
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>';
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Implements hook_theme().
|
|
*/
|
|
function system_theme() {
|
|
return array_merge(drupal_common_theme(), array(
|
|
'system_themes_page' => array(
|
|
'variables' => array('theme_groups' => NULL),
|
|
'file' => 'system.admin.inc',
|
|
),
|
|
'system_config_form' => array(
|
|
'render element' => 'form',
|
|
),
|
|
'confirm_form' => array(
|
|
'render element' => 'form',
|
|
),
|
|
'system_modules_details' => array(
|
|
'render element' => 'form',
|
|
'file' => 'system.admin.inc',
|
|
),
|
|
'system_modules_incompatible' => array(
|
|
'variables' => array('message' => NULL),
|
|
'file' => 'system.admin.inc',
|
|
),
|
|
'system_modules_uninstall' => array(
|
|
'render element' => 'form',
|
|
'file' => 'system.admin.inc',
|
|
),
|
|
'status_report' => array(
|
|
'variables' => array('requirements' => NULL),
|
|
'file' => 'system.admin.inc',
|
|
),
|
|
'admin_page' => array(
|
|
'variables' => array('blocks' => NULL),
|
|
'file' => 'system.admin.inc',
|
|
),
|
|
'admin_block' => array(
|
|
'variables' => array('block' => NULL),
|
|
'file' => 'system.admin.inc',
|
|
),
|
|
'admin_block_content' => array(
|
|
'variables' => array('content' => NULL),
|
|
'file' => 'system.admin.inc',
|
|
),
|
|
'system_admin_index' => array(
|
|
'variables' => array('menu_items' => NULL),
|
|
'file' => 'system.admin.inc',
|
|
),
|
|
'system_powered_by' => array(
|
|
'variables' => array(),
|
|
),
|
|
'system_compact_link' => array(
|
|
'variables' => array(),
|
|
),
|
|
'system_date_format_localize_form' => array(
|
|
'render element' => 'form',
|
|
),
|
|
));
|
|
}
|
|
|
|
/**
|
|
* Implements hook_permission().
|
|
*/
|
|
function system_permission() {
|
|
return array(
|
|
'administer modules' => array(
|
|
'title' => t('Administer modules'),
|
|
),
|
|
'administer site configuration' => array(
|
|
'title' => t('Administer site configuration'),
|
|
'restrict access' => TRUE,
|
|
),
|
|
'administer themes' => array(
|
|
'title' => t('Administer themes'),
|
|
),
|
|
'administer software updates' => array(
|
|
'title' => t('Administer software updates'),
|
|
'restrict access' => TRUE,
|
|
),
|
|
'access administration pages' => array(
|
|
'title' => t('Use the administration pages and help'),
|
|
),
|
|
'access site in maintenance mode' => array(
|
|
'title' => t('Use the site in maintenance mode'),
|
|
),
|
|
'view the administration theme' => array(
|
|
'title' => t('View the administration theme'),
|
|
'description' => Drupal::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'))),
|
|
),
|
|
'access site reports' => array(
|
|
'title' => t('View site reports'),
|
|
),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* 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',
|
|
);
|
|
$hooks['tokens_alter'] = array(
|
|
'group' => 'tokens',
|
|
);
|
|
|
|
return $hooks;
|
|
}
|
|
|
|
/**
|
|
* Implements hook_element_info().
|
|
*/
|
|
function system_element_info() {
|
|
// Top level elements.
|
|
$types['form'] = array(
|
|
'#method' => 'post',
|
|
'#action' => request_uri(),
|
|
'#theme_wrappers' => array('form'),
|
|
);
|
|
$types['page'] = array(
|
|
'#show_messages' => TRUE,
|
|
'#theme' => 'page',
|
|
'#theme_wrappers' => array('html'),
|
|
);
|
|
// By default, we don't want Ajax commands being rendered in the context of an
|
|
// 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).
|
|
$types['ajax'] = array(
|
|
'#header' => TRUE,
|
|
'#commands' => array(),
|
|
'#error' => NULL,
|
|
);
|
|
$types['html_tag'] = array(
|
|
'#pre_render' => array('drupal_pre_render_conditional_comments', 'drupal_pre_render_html_tag'),
|
|
'#attributes' => array(),
|
|
'#value' => NULL,
|
|
);
|
|
$types['styles'] = array(
|
|
'#items' => array(),
|
|
'#pre_render' => array('drupal_pre_render_styles'),
|
|
);
|
|
$types['scripts'] = array(
|
|
'#items' => array(),
|
|
'#pre_render' => array('drupal_pre_render_scripts'),
|
|
);
|
|
|
|
// Input elements.
|
|
$types['submit'] = array(
|
|
'#input' => TRUE,
|
|
'#name' => 'op',
|
|
'#is_button' => TRUE,
|
|
'#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'),
|
|
);
|
|
$types['button'] = array(
|
|
'#input' => TRUE,
|
|
'#name' => 'op',
|
|
'#is_button' => TRUE,
|
|
'#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'),
|
|
);
|
|
$types['image_button'] = array(
|
|
'#input' => TRUE,
|
|
'#is_button' => TRUE,
|
|
'#executes_submit_callback' => TRUE,
|
|
'#limit_validation_errors' => FALSE,
|
|
'#process' => array('form_process_button', 'ajax_process_form'),
|
|
'#return_value' => TRUE,
|
|
'#has_garbage_value' => TRUE,
|
|
'#src' => NULL,
|
|
'#pre_render' => array('form_pre_render_image_button'),
|
|
'#theme_wrappers' => array('input__image_button'),
|
|
);
|
|
$types['textfield'] = array(
|
|
'#input' => TRUE,
|
|
'#size' => 60,
|
|
'#maxlength' => 128,
|
|
'#autocomplete_path' => FALSE,
|
|
'#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern'),
|
|
'#pre_render' => array('form_pre_render_textfield'),
|
|
'#theme' => 'input__textfield',
|
|
'#theme_wrappers' => array('form_element'),
|
|
);
|
|
$types['tel'] = array(
|
|
'#input' => TRUE,
|
|
'#size' => 30,
|
|
'#maxlength' => 128,
|
|
'#autocomplete_path' => 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'),
|
|
);
|
|
$types['email'] = array(
|
|
'#input' => TRUE,
|
|
'#size' => 60,
|
|
// user.module is not loaded in case of early bootstrap errors.
|
|
'#maxlength' => defined('EMAIL_MAX_LENGTH') ? EMAIL_MAX_LENGTH : 255,
|
|
'#autocomplete_path' => FALSE,
|
|
'#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern'),
|
|
'#element_validate' => array('form_validate_email'),
|
|
'#pre_render' => array('form_pre_render_email'),
|
|
'#theme' => 'input__email',
|
|
'#theme_wrappers' => array('form_element'),
|
|
);
|
|
$types['url'] = array(
|
|
'#input' => TRUE,
|
|
'#size' => 60,
|
|
'#maxlength' => 255,
|
|
'#autocomplete_path' => FALSE,
|
|
'#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern'),
|
|
'#element_validate' => array('form_validate_url'),
|
|
'#pre_render' => array('form_pre_render_url'),
|
|
'#theme' => 'input__url',
|
|
'#theme_wrappers' => array('form_element'),
|
|
);
|
|
$types['search'] = array(
|
|
'#input' => TRUE,
|
|
'#size' => 60,
|
|
'#maxlength' => 128,
|
|
'#autocomplete_path' => FALSE,
|
|
'#process' => array('form_process_autocomplete', 'ajax_process_form'),
|
|
'#pre_render' => array('form_pre_render_search'),
|
|
'#theme' => 'input__search',
|
|
'#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'),
|
|
);
|
|
$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',
|
|
'#theme_wrappers' => array('form_element'),
|
|
);
|
|
$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',
|
|
'#theme_wrappers' => array('form_element'),
|
|
);
|
|
$types['machine_name'] = array(
|
|
'#input' => TRUE,
|
|
'#default_value' => NULL,
|
|
'#required' => TRUE,
|
|
'#maxlength' => 64,
|
|
'#size' => 60,
|
|
'#autocomplete_path' => FALSE,
|
|
'#process' => array('form_process_machine_name', 'form_process_autocomplete', 'ajax_process_form'),
|
|
'#element_validate' => array('form_validate_machine_name'),
|
|
'#pre_render' => array('form_pre_render_textfield'),
|
|
'#theme' => 'input__textfield',
|
|
'#theme_wrappers' => array('form_element'),
|
|
);
|
|
$types['password'] = array(
|
|
'#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'),
|
|
);
|
|
$types['password_confirm'] = array(
|
|
'#input' => TRUE,
|
|
'#process' => array('form_process_password_confirm', 'user_form_process_password_confirm'),
|
|
'#theme_wrappers' => array('form_element'),
|
|
);
|
|
$types['textarea'] = array(
|
|
'#input' => TRUE,
|
|
'#cols' => 60,
|
|
'#rows' => 5,
|
|
'#resizable' => 'vertical',
|
|
'#process' => array('ajax_process_form'),
|
|
'#theme' => 'textarea',
|
|
'#theme_wrappers' => array('form_element'),
|
|
);
|
|
$types['radios'] = array(
|
|
'#input' => TRUE,
|
|
'#process' => array('form_process_radios'),
|
|
'#theme_wrappers' => array('radios'),
|
|
'#pre_render' => array('form_pre_render_conditional_form_element'),
|
|
);
|
|
$types['radio'] = array(
|
|
'#input' => TRUE,
|
|
'#default_value' => NULL,
|
|
'#process' => array('ajax_process_form'),
|
|
'#pre_render' => array('form_pre_render_radio'),
|
|
'#theme' => 'input__radio',
|
|
'#theme_wrappers' => array('form_element'),
|
|
'#title_display' => 'after',
|
|
);
|
|
$types['checkboxes'] = array(
|
|
'#input' => TRUE,
|
|
'#process' => array('form_process_checkboxes'),
|
|
'#pre_render' => array('form_pre_render_conditional_form_element'),
|
|
'#theme_wrappers' => array('checkboxes'),
|
|
);
|
|
$types['checkbox'] = array(
|
|
'#input' => TRUE,
|
|
'#return_value' => 1,
|
|
'#process' => array('form_process_checkbox', 'ajax_process_form'),
|
|
'#pre_render' => array('form_pre_render_checkbox'),
|
|
'#theme' => 'input__checkbox',
|
|
'#theme_wrappers' => array('form_element'),
|
|
'#title_display' => 'after',
|
|
);
|
|
$types['select'] = array(
|
|
'#input' => TRUE,
|
|
'#multiple' => FALSE,
|
|
'#process' => array('form_process_select', 'ajax_process_form'),
|
|
'#theme' => 'select',
|
|
'#theme_wrappers' => array('form_element'),
|
|
'#options' => array(),
|
|
);
|
|
$types['language_select'] = array(
|
|
'#input' => TRUE,
|
|
'#default_value' => Language::LANGCODE_NOT_SPECIFIED,
|
|
);
|
|
$types['weight'] = array(
|
|
'#input' => TRUE,
|
|
'#delta' => 10,
|
|
'#default_value' => 0,
|
|
'#process' => array('form_process_weight', 'ajax_process_form'),
|
|
);
|
|
$types['date'] = array(
|
|
'#input' => TRUE,
|
|
'#theme' => 'date',
|
|
'#theme_wrappers' => array('form_element'),
|
|
);
|
|
$types['file'] = array(
|
|
'#input' => TRUE,
|
|
'#multiple' => FALSE,
|
|
'#process' => array('form_process_file'),
|
|
'#size' => 60,
|
|
'#pre_render' => array('form_pre_render_file'),
|
|
'#theme' => 'input__file',
|
|
'#theme_wrappers' => array('form_element'),
|
|
);
|
|
$types['tableselect'] = array(
|
|
'#input' => TRUE,
|
|
'#js_select' => TRUE,
|
|
'#multiple' => TRUE,
|
|
'#process' => array('form_process_tableselect'),
|
|
'#options' => array(),
|
|
'#empty' => '',
|
|
'#theme' => 'tableselect',
|
|
);
|
|
|
|
// Form structure.
|
|
$types['item'] = array(
|
|
// 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'),
|
|
);
|
|
$types['hidden'] = array(
|
|
'#input' => TRUE,
|
|
'#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',
|
|
);
|
|
$types['value'] = array(
|
|
'#input' => TRUE,
|
|
);
|
|
$types['link'] = array(
|
|
'#pre_render' => array('drupal_pre_render_link'),
|
|
);
|
|
$types['fieldset'] = array(
|
|
'#value' => NULL,
|
|
'#process' => array('form_process_group', 'ajax_process_form'),
|
|
'#pre_render' => array('form_pre_render_group'),
|
|
'#theme_wrappers' => array('fieldset'),
|
|
);
|
|
$types['details'] = array(
|
|
'#collapsed' => FALSE,
|
|
'#value' => NULL,
|
|
'#process' => array('form_process_group', 'ajax_process_form'),
|
|
'#pre_render' => array('form_pre_render_details', 'form_pre_render_group'),
|
|
'#theme_wrappers' => array('details'),
|
|
);
|
|
$types['vertical_tabs'] = array(
|
|
'#default_tab' => '',
|
|
'#process' => array('form_process_vertical_tabs'),
|
|
'#pre_render' => array('form_pre_render_vertical_tabs'),
|
|
'#theme_wrappers' => array('vertical_tabs', 'form_element'),
|
|
);
|
|
$types['dropbutton'] = array(
|
|
'#pre_render' => array('drupal_pre_render_dropbutton'),
|
|
'#theme' => 'links__dropbutton',
|
|
);
|
|
$types['operations'] = array(
|
|
'#pre_render' => array('drupal_pre_render_dropbutton'),
|
|
'#theme' => 'links__dropbutton__operations',
|
|
);
|
|
|
|
$types['container'] = array(
|
|
'#process' => array('form_process_group', 'form_process_container'),
|
|
'#pre_render' => array('form_pre_render_group'),
|
|
'#theme_wrappers' => array('container'),
|
|
);
|
|
$types['actions'] = array(
|
|
'#process' => array('form_pre_render_actions_dropbutton', 'form_process_actions', 'form_process_container'),
|
|
'#weight' => 100,
|
|
'#theme_wrappers' => array('container'),
|
|
);
|
|
|
|
$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',
|
|
);
|
|
|
|
return $types;
|
|
}
|
|
|
|
/**
|
|
* Implements hook_menu().
|
|
*/
|
|
function system_menu() {
|
|
$items['system/temporary'] = array(
|
|
'title' => 'Temporary files',
|
|
'page callback' => 'file_download',
|
|
'page arguments' => array('temporary'),
|
|
'access callback' => TRUE,
|
|
'type' => MENU_CALLBACK,
|
|
);
|
|
$items['system/ajax'] = array(
|
|
'title' => 'AHAH callback',
|
|
'route_name' => 'system.ajax',
|
|
'theme callback' => 'ajax_base_page_theme',
|
|
'type' => MENU_CALLBACK,
|
|
);
|
|
$items['admin'] = array(
|
|
'title' => 'Administration',
|
|
'access arguments' => array('access administration pages'),
|
|
'page callback' => 'system_admin_menu_block_page',
|
|
'weight' => 9,
|
|
'menu_name' => 'admin',
|
|
'file' => 'system.admin.inc',
|
|
);
|
|
$items['admin/tasks'] = array(
|
|
'title' => 'Tasks',
|
|
'type' => MENU_DEFAULT_LOCAL_TASK,
|
|
'weight' => -20,
|
|
);
|
|
$items['admin/index'] = array(
|
|
'title' => 'Index',
|
|
'route_name' => 'system_admin_index',
|
|
'type' => MENU_LOCAL_TASK,
|
|
'weight' => -18,
|
|
);
|
|
|
|
// Menu items that are basically just menu blocks.
|
|
$items['admin/structure'] = array(
|
|
'title' => 'Structure',
|
|
'description' => 'Administer blocks, content types, menus, etc.',
|
|
'position' => 'right',
|
|
'weight' => -8,
|
|
'page callback' => 'system_admin_menu_block_page',
|
|
'access arguments' => array('access administration pages'),
|
|
'file' => 'system.admin.inc',
|
|
);
|
|
// Appearance.
|
|
$items['admin/appearance'] = array(
|
|
'title' => 'Appearance',
|
|
'description' => 'Select and configure your themes.',
|
|
'page callback' => 'system_themes_page',
|
|
'access arguments' => array('administer themes'),
|
|
'position' => 'left',
|
|
'weight' => -6,
|
|
'file' => 'system.admin.inc',
|
|
);
|
|
$items['admin/appearance/list'] = array(
|
|
'title' => 'List',
|
|
'description' => 'Select and configure your theme',
|
|
'type' => MENU_DEFAULT_LOCAL_TASK,
|
|
'file' => 'system.admin.inc',
|
|
);
|
|
$items['admin/appearance/default'] = array(
|
|
'title' => 'Set default theme',
|
|
'page callback' => 'system_theme_default',
|
|
'access arguments' => array('administer themes'),
|
|
'type' => MENU_CALLBACK,
|
|
'file' => 'system.admin.inc',
|
|
);
|
|
$items['admin/appearance/settings'] = array(
|
|
'title' => 'Settings',
|
|
'description' => 'Configure default and theme specific settings.',
|
|
'route_name' => 'system_theme_settings',
|
|
'type' => MENU_LOCAL_TASK,
|
|
'weight' => 100,
|
|
);
|
|
// Theme configuration local tasks.
|
|
$items['admin/appearance/settings/global'] = array(
|
|
'title' => 'Global settings',
|
|
'type' => MENU_DEFAULT_LOCAL_TASK,
|
|
);
|
|
|
|
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,
|
|
);
|
|
}
|
|
}
|
|
|
|
// Modules.
|
|
$items['admin/modules'] = array(
|
|
'title' => 'Extend',
|
|
'description' => 'Add and enable modules to extend site functionality.',
|
|
'route_name' => 'system_modules_list',
|
|
'weight' => -2,
|
|
);
|
|
$items['admin/modules/list'] = array(
|
|
'title' => 'List',
|
|
'type' => MENU_DEFAULT_LOCAL_TASK,
|
|
);
|
|
$items['admin/modules/list/confirm'] = array(
|
|
'title' => 'List',
|
|
'route_name' => 'system_modules_list_confirm',
|
|
'type' => MENU_VISIBLE_IN_BREADCRUMB,
|
|
);
|
|
$items['admin/modules/uninstall'] = array(
|
|
'title' => 'Uninstall',
|
|
'route_name' => 'system_modules_uninstall',
|
|
'type' => MENU_LOCAL_TASK,
|
|
'weight' => 20,
|
|
);
|
|
$items['admin/modules/uninstall/confirm'] = array(
|
|
'title' => 'Uninstall',
|
|
'route_name' => 'system_modules_uninstall_confirm',
|
|
'type' => MENU_VISIBLE_IN_BREADCRUMB,
|
|
);
|
|
|
|
// Configuration.
|
|
$items['admin/config'] = array(
|
|
'title' => 'Configuration',
|
|
'description' => 'Administer settings.',
|
|
'route_name' => 'system_admin_config',
|
|
);
|
|
|
|
// Media settings.
|
|
$items['admin/config/media'] = array(
|
|
'title' => 'Media',
|
|
'description' => 'Media tools.',
|
|
'position' => 'left',
|
|
'weight' => -10,
|
|
'page callback' => 'system_admin_menu_block_page',
|
|
'access arguments' => array('access administration pages'),
|
|
'file' => 'system.admin.inc',
|
|
);
|
|
$items['admin/config/media/file-system'] = array(
|
|
'title' => 'File system',
|
|
'description' => 'Tell Drupal where to store uploaded files and how they are accessed.',
|
|
'route_name' => 'system_file_system_settings',
|
|
'weight' => -10,
|
|
);
|
|
$items['admin/config/media/image-toolkit'] = array(
|
|
'title' => 'Image toolkit',
|
|
'description' => 'Choose which image toolkit to use if you have installed optional toolkits.',
|
|
'route_name' => 'system_image_toolkit_settings',
|
|
'weight' => 20,
|
|
);
|
|
|
|
// Service settings.
|
|
$items['admin/config/services'] = array(
|
|
'title' => 'Web services',
|
|
'description' => 'Tools related to web services.',
|
|
'position' => 'right',
|
|
'weight' => 0,
|
|
'page callback' => 'system_admin_menu_block_page',
|
|
'access arguments' => array('access administration pages'),
|
|
'file' => 'system.admin.inc',
|
|
);
|
|
$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.',
|
|
'position' => 'right',
|
|
'weight' => -10,
|
|
'page callback' => 'system_admin_menu_block_page',
|
|
'access arguments' => array('access administration pages'),
|
|
'file' => 'system.admin.inc',
|
|
);
|
|
$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',
|
|
'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',
|
|
'weight' => -20,
|
|
);
|
|
$items['admin/config/development/logging'] = array(
|
|
'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',
|
|
'weight' => -15,
|
|
);
|
|
|
|
// Regional and date settings.
|
|
$items['admin/config/regional'] = array(
|
|
'title' => 'Regional and language',
|
|
'description' => 'Regional settings, localization and translation.',
|
|
'position' => 'left',
|
|
'weight' => -5,
|
|
'page callback' => 'system_admin_menu_block_page',
|
|
'access arguments' => array('access administration pages'),
|
|
'file' => 'system.admin.inc',
|
|
);
|
|
$items['admin/config/regional/settings'] = array(
|
|
'title' => 'Regional settings',
|
|
'description' => "Settings for the site's default time zone and country.",
|
|
'route_name' => 'system_regional_settings',
|
|
'weight' => -20,
|
|
);
|
|
$items['admin/config/regional/date-time'] = array(
|
|
'title' => 'Date and time formats',
|
|
'description' => 'Configure display format strings for date and time.',
|
|
'route_name' => 'date_format_list',
|
|
'weight' => -9,
|
|
);
|
|
$items['admin/config/regional/date-time/formats/add'] = array(
|
|
'title' => 'Add format',
|
|
'description' => 'Allow users to add additional date formats.',
|
|
'type' => MENU_LOCAL_ACTION,
|
|
'route_name' => 'date_format_add',
|
|
'weight' => -10,
|
|
);
|
|
$items['admin/config/regional/date-time/formats/manage/%'] = array(
|
|
'title' => 'Edit date format',
|
|
'description' => 'Allow users to edit a configured date format.',
|
|
'route_name' => 'date_format_edit',
|
|
);
|
|
$items['admin/config/regional/date-time/formats/manage/%/delete'] = array(
|
|
'title' => 'Delete date format',
|
|
'description' => 'Allow users to delete a configured date format.',
|
|
'route_name' => 'date_format_delete',
|
|
);
|
|
|
|
// Search settings.
|
|
$items['admin/config/search'] = array(
|
|
'title' => 'Search and metadata',
|
|
'description' => 'Local site search, metadata and SEO.',
|
|
'position' => 'left',
|
|
'weight' => -10,
|
|
'page callback' => 'system_admin_menu_block_page',
|
|
'access arguments' => array('access administration pages'),
|
|
'file' => 'system.admin.inc',
|
|
);
|
|
|
|
// System settings.
|
|
$items['admin/config/system'] = array(
|
|
'title' => 'System',
|
|
'description' => 'General system related configuration.',
|
|
'position' => 'right',
|
|
'weight' => -20,
|
|
'page callback' => 'system_admin_menu_block_page',
|
|
'access arguments' => array('access administration pages'),
|
|
'file' => 'system.admin.inc',
|
|
);
|
|
$items['admin/config/system/site-information'] = array(
|
|
'title' => 'Site information',
|
|
'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['admin/config/system/cron'] = array(
|
|
'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',
|
|
'page callback' => 'system_admin_menu_block_page',
|
|
'access arguments' => array('access administration pages'),
|
|
'file' => 'system.admin.inc',
|
|
'weight' => -15,
|
|
);
|
|
$items['admin/config/workflow'] = array(
|
|
'title' => 'Workflow',
|
|
'description' => 'Content workflow, editorial workflow tools.',
|
|
'position' => 'right',
|
|
'weight' => 5,
|
|
'page callback' => 'system_admin_menu_block_page',
|
|
'access arguments' => array('access administration pages'),
|
|
'file' => 'system.admin.inc',
|
|
);
|
|
$items['admin/config/content'] = array(
|
|
'title' => 'Content authoring',
|
|
'description' => 'Settings related to formatting and authoring content.',
|
|
'position' => 'left',
|
|
'weight' => -15,
|
|
'page callback' => 'system_admin_menu_block_page',
|
|
'access arguments' => array('access administration pages'),
|
|
'file' => 'system.admin.inc',
|
|
);
|
|
|
|
// Reports.
|
|
$items['admin/reports'] = array(
|
|
'title' => 'Reports',
|
|
'description' => 'View reports, updates, and errors.',
|
|
'page callback' => 'system_admin_menu_block_page',
|
|
'access arguments' => array('access site reports'),
|
|
'weight' => 5,
|
|
'position' => 'left',
|
|
'file' => 'system.admin.inc',
|
|
);
|
|
$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',
|
|
);
|
|
|
|
// Default page for batch operations.
|
|
$items['batch'] = array(
|
|
'page callback' => 'system_batch_page',
|
|
'access callback' => TRUE,
|
|
'theme callback' => '_system_batch_theme',
|
|
'type' => MENU_CALLBACK,
|
|
'file' => 'system.admin.inc',
|
|
);
|
|
|
|
// Localize date formats.
|
|
if (module_exists('language')) {
|
|
$items['admin/config/regional/date-time/locale'] = array(
|
|
'title' => 'Localize',
|
|
'description' => 'Configure date formats for each locale',
|
|
'page callback' => 'system_date_format_language_overview_page',
|
|
'access arguments' => array('administer site configuration'),
|
|
'type' => MENU_LOCAL_TASK,
|
|
'weight' => -8,
|
|
'file' => 'system.admin.inc',
|
|
);
|
|
$items['admin/config/regional/date-time/locale/%/edit'] = array(
|
|
'title' => 'Localize date formats',
|
|
'description' => 'Configure date formats for each locale',
|
|
'page callback' => 'drupal_get_form',
|
|
'page arguments' => array('system_date_format_localize_form', 5),
|
|
'access arguments' => array('administer site configuration'),
|
|
'file' => 'system.admin.inc',
|
|
);
|
|
$items['admin/config/regional/date-time/locale/%/reset'] = array(
|
|
'title' => 'Reset date formats',
|
|
'description' => 'Reset localized date formats to global defaults',
|
|
'route_name' => 'date_format_localize_reset',
|
|
);
|
|
}
|
|
|
|
return $items;
|
|
}
|
|
|
|
/**
|
|
* Theme callback for the default batch page.
|
|
*/
|
|
function _system_batch_theme() {
|
|
// Retrieve the current state of the batch.
|
|
$batch = &batch_get();
|
|
if (!$batch && isset($_REQUEST['id'])) {
|
|
$batch = Drupal::service('batch.storage')->load($_REQUEST['id']);
|
|
}
|
|
// Use the same theme as the page that started the batch.
|
|
if (!empty($batch['theme'])) {
|
|
return $batch['theme'];
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Implements hook_library_info().
|
|
*/
|
|
function system_library_info() {
|
|
// Drupal-specific JavaScript.
|
|
$libraries['drupal'] = array(
|
|
'title' => 'Drupal',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
'core/misc/drupal.js' => array('group' => JS_LIBRARY, 'weight' => -18),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'domready'),
|
|
),
|
|
);
|
|
|
|
// Drupal settings.
|
|
$libraries['drupalSettings'] = array(
|
|
'title' => 'Drupal Settings',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
array('type' => 'setting', 'data' => array()),
|
|
),
|
|
);
|
|
|
|
// Drupal's Ajax framework.
|
|
$libraries['drupal.ajax'] = array(
|
|
'title' => 'Drupal AJAX',
|
|
'website' => 'http://api.drupal.org/api/group/ajax/8',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
'core/misc/ajax.js' => array('group' => JS_LIBRARY, 'weight' => 2),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
array('system', 'drupal'),
|
|
array('system', 'drupalSettings'),
|
|
array('system', 'drupal.progress'),
|
|
array('system', 'jquery.once'),
|
|
),
|
|
);
|
|
|
|
// Drupal's Screen Reader change announcement utility.
|
|
$libraries['drupal.announce'] = array(
|
|
'title' => 'Drupal announce',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
'core/misc/announce.js' => array('group' => JS_LIBRARY),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'drupal'),
|
|
array('system', 'drupal.debounce'),
|
|
),
|
|
);
|
|
|
|
// Drupal's batch API.
|
|
$libraries['drupal.batch'] = array(
|
|
'title' => 'Drupal batch API',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
'core/misc/batch.js' => array('group' => JS_DEFAULT, 'cache' => FALSE),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
array('system', 'drupal'),
|
|
array('system', 'drupalSettings'),
|
|
array('system', 'drupal.ajax'),
|
|
array('system', 'drupal.progress'),
|
|
array('system', 'jquery.once'),
|
|
),
|
|
);
|
|
|
|
// Drupal's progress indicator.
|
|
$libraries['drupal.progress'] = array(
|
|
'title' => 'Drupal progress indicator',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
'core/misc/progress.js' => array('group' => JS_DEFAULT),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'drupal'),
|
|
array('system', 'jquery'),
|
|
array('system', 'drupalSettings'),
|
|
),
|
|
);
|
|
|
|
// Drupal's form library.
|
|
$libraries['drupal.form'] = array(
|
|
'title' => 'Drupal form library',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
'core/misc/form.js' => array('group' => JS_LIBRARY, 'weight' => 1),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
array('system', 'drupal'),
|
|
array('system', 'jquery.cookie'),
|
|
array('system', 'jquery.once'),
|
|
),
|
|
);
|
|
|
|
// Drupal's dialog component.
|
|
$libraries['drupal.dialog'] = array(
|
|
'title' => 'Drupal Dialog',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
'core/misc/dialog.js' => array('group' => JS_LIBRARY),
|
|
),
|
|
'css' => array(
|
|
'core/misc/dialog.theme.css' => array('weight' => 1),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
array('system', 'drupal'),
|
|
array('system', 'drupal.debounce'),
|
|
array('system', 'drupalSettings'),
|
|
array('system', 'jquery.ui.dialog')
|
|
),
|
|
);
|
|
|
|
// Drupal's integration between AJAX and dialogs.
|
|
$libraries['drupal.dialog.ajax'] = array(
|
|
'title' => 'Drupal Dialog AJAX',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
'core/misc/dialog.ajax.js' => array('group' => JS_LIBRARY, 'weight' => 3),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
array('system', 'drupal'),
|
|
array('system', 'drupalSettings'),
|
|
array('system', 'drupal.ajax'),
|
|
array('system', 'drupal.dialog'),
|
|
),
|
|
);
|
|
|
|
// Drupal's states library.
|
|
$libraries['drupal.states'] = array(
|
|
'title' => 'Drupal states',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
'core/misc/states.js' => array('group' => JS_LIBRARY, 'weight' => 1),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
array('system', 'drupal'),
|
|
array('system', 'drupalSettings'),
|
|
array('system', 'jquery.once'),
|
|
),
|
|
);
|
|
|
|
// Drupal's tabledrag library.
|
|
$libraries['drupal.tabledrag'] = array(
|
|
'title' => 'Drupal tabledrag',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
'core/misc/tabledrag.js' => array('group' => JS_LIBRARY, 'weight' => -1),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
array('system', 'modernizr'),
|
|
array('system', 'drupal'),
|
|
array('system', 'drupalSettings'),
|
|
array('system', 'jquery.once'),
|
|
array('system', 'jquery.cookie'),
|
|
),
|
|
);
|
|
|
|
// Drupal's responsive table API.
|
|
$libraries['drupal.tableresponsive'] = array(
|
|
'title' => 'Drupal responsive table API',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
'core/misc/tableresponsive.js' => array('group' => JS_LIBRARY),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
array('system', 'drupal'),
|
|
array('system', 'jquery.once'),
|
|
),
|
|
);
|
|
|
|
// Collapsible details.
|
|
$libraries['drupal.collapse'] = array(
|
|
'title' => 'Collapsible details',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
'core/misc/collapse.js' => array('group' => JS_DEFAULT),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
array('system', 'modernizr'),
|
|
array('system', 'drupal'),
|
|
// collapse.js relies on drupalGetSummary in form.js
|
|
array('system', 'drupal.form'),
|
|
array('system', 'jquery.once'),
|
|
),
|
|
);
|
|
|
|
// Drupal's autocomplete widget.
|
|
$libraries['drupal.autocomplete'] = array(
|
|
'title' => 'Drupal autocomplete',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
'core/misc/autocomplete.js' => array('group' => JS_DEFAULT),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
array('system', 'drupal'),
|
|
array('system', 'drupal.ajax'),
|
|
),
|
|
);
|
|
|
|
// A utility that measures and reports viewport offset dimensions from
|
|
// elements like the toolbar that can potentially displace the positioning of
|
|
// elements like the overlay.
|
|
$libraries['drupal.displace'] = array(
|
|
'title' => 'Drupal displace',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
'core/misc/displace.js' => array('group' => JS_LIBRARY),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
array('system', 'drupal'),
|
|
array('system', 'drupal.debounce'),
|
|
),
|
|
);
|
|
|
|
// Manages tab orders in the document.
|
|
$libraries['drupal.tabbingmanager'] = array(
|
|
'title' => 'Drupal tabbing manager',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
'core/misc/tabbingmanager.js' => array('group' => JS_LIBRARY),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
// Depends on jQuery UI Core to use the ":tabbable" pseudo selector.
|
|
array('system', 'jquery.ui.core'),
|
|
array('system', 'drupal'),
|
|
),
|
|
);
|
|
|
|
// A utility function to limit calls to a function with a given time.
|
|
$libraries['drupal.debounce'] = array(
|
|
'title' => 'Drupal debounce',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
'core/misc/debounce.js' => array('group' => JS_LIBRARY),
|
|
),
|
|
'dependencies' => array(
|
|
// @todo remove drupal dependency.
|
|
array('system', 'drupal'),
|
|
),
|
|
);
|
|
|
|
// domReady.
|
|
$libraries['domready'] = array(
|
|
'title' => 'domReady',
|
|
'website' => 'https://github.com/ded/domready',
|
|
'version' => 'master',
|
|
'js' => array(
|
|
'core/assets/vendor/domready/ready.min.js' => array('group' => JS_LIBRARY, 'weight' => -21),
|
|
),
|
|
);
|
|
|
|
// jQuery.
|
|
$libraries['jquery'] = array(
|
|
'title' => 'jQuery',
|
|
'website' => 'http://jquery.com',
|
|
'version' => '2.0.3',
|
|
'js' => array(
|
|
'core/assets/vendor/jquery/jquery.js' => array('group' => JS_LIBRARY, 'weight' => -20),
|
|
),
|
|
);
|
|
|
|
// jQuery Once.
|
|
$libraries['jquery.once'] = array(
|
|
'title' => 'jQuery Once',
|
|
'website' => 'http://plugins.jquery.com/project/once',
|
|
'version' => '1.2',
|
|
'js' => array(
|
|
'core/assets/vendor/jquery-once/jquery.once.js' => array('group' => JS_LIBRARY, 'weight' => -19),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
),
|
|
);
|
|
|
|
// jQuery Form Plugin.
|
|
$libraries['jquery.form'] = array(
|
|
'title' => 'jQuery Form Plugin',
|
|
'website' => 'http://malsup.com/jquery/form/',
|
|
'version' => '3.39',
|
|
'js' => array(
|
|
'core/assets/vendor/jquery-form/jquery.form.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
array('system', 'jquery.cookie'),
|
|
),
|
|
);
|
|
|
|
// jQuery BBQ plugin.
|
|
$libraries['jquery.bbq'] = array(
|
|
'title' => 'jQuery BBQ',
|
|
'website' => 'http://benalman.com/projects/jquery-bbq-plugin/',
|
|
'version' => '1.3pre',
|
|
'js' => array(
|
|
'core/assets/vendor/jquery-bbq/jquery.ba-bbq.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
),
|
|
);
|
|
|
|
// Dropbutton.
|
|
$libraries['drupal.dropbutton'] = array(
|
|
'title' => 'Dropbutton',
|
|
'website' => 'http://drupal.org/node/1608878',
|
|
'version' => '1.0',
|
|
'js' => array(
|
|
'core/misc/dropbutton/dropbutton.js' => array(),
|
|
),
|
|
'css' => array(
|
|
'core/misc/dropbutton/dropbutton.css' => array(),
|
|
'core/misc/dropbutton/dropbutton.theme.css' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
array('system', 'drupal'),
|
|
array('system', 'drupalSettings'),
|
|
array('system', 'jquery.once'),
|
|
),
|
|
);
|
|
|
|
// Vertical Tabs.
|
|
$libraries['drupal.vertical-tabs'] = array(
|
|
'title' => 'Vertical Tabs',
|
|
'website' => 'http://drupal.org/node/323112',
|
|
'version' => '1.0',
|
|
'js' => array(
|
|
'core/misc/vertical-tabs.js' => array(),
|
|
),
|
|
'css' => array(
|
|
'core/misc/vertical-tabs.css' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
array('system', 'drupal'),
|
|
array('system', 'drupalSettings'),
|
|
// Vertical tabs relies on drupalGetSummary in form.js
|
|
array('system', 'drupal.form'),
|
|
),
|
|
);
|
|
|
|
// matchMedia polyfill.
|
|
$libraries['matchmedia'] = array(
|
|
'title' => 'window.matchMedia polyfill',
|
|
'website' => 'http://drupal.org/node/1815602',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
'core/misc/matchmedia.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'drupal.debounce'),
|
|
),
|
|
);
|
|
|
|
// Farbtastic.
|
|
$libraries['jquery.farbtastic'] = array(
|
|
'title' => 'Farbtastic',
|
|
'website' => 'http://code.google.com/p/farbtastic/',
|
|
'version' => '1.2',
|
|
'js' => array(
|
|
'core/assets/vendor/farbtastic/farbtastic.js' => array(),
|
|
),
|
|
'css' => array(
|
|
'core/assets/vendor/farbtastic/farbtastic.css' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
),
|
|
);
|
|
|
|
// HTML5 Shiv.
|
|
$libraries['html5shiv'] = array(
|
|
'title' => 'html5shiv',
|
|
'website' => 'https://github.com/aFarkas/html5shiv/',
|
|
'version' => '3.6.2',
|
|
'js' => array(
|
|
'core/assets/vendor/html5shiv/html5.js' => array(
|
|
'group' => JS_LIBRARY,
|
|
'weight' => -22,
|
|
'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE),
|
|
),
|
|
),
|
|
);
|
|
|
|
// Modernizr.
|
|
$libraries['modernizr'] = array(
|
|
'title' => 'Modernizr',
|
|
'website' => 'http://modernizr.com/',
|
|
'version' => '2.6.2',
|
|
'js' => array(
|
|
'core/assets/vendor/modernizr/modernizr.min.js' => array(
|
|
'every_page' => TRUE,
|
|
'group' => JS_LIBRARY,
|
|
'preprocess' => 0,
|
|
'scope' => 'header',
|
|
'weight' => -21,
|
|
),
|
|
),
|
|
);
|
|
|
|
// Normalize.
|
|
$libraries['normalize'] = array(
|
|
'title' => 'normalize.css',
|
|
'website' => 'http://git.io/normalize',
|
|
'version' => '2.1.2',
|
|
'css' => array(
|
|
'core/assets/vendor/normalize-css/normalize.css' => array(
|
|
'every_page' => TRUE,
|
|
'weight' => CSS_BASE - 20,
|
|
),
|
|
),
|
|
);
|
|
|
|
// Drupal's base CSS.
|
|
$libraries['drupal.base'] = array(
|
|
'title' => 'Drupal base CSS',
|
|
'version' => VERSION,
|
|
'css' => array(
|
|
'core/misc/drupal.base.css' => array(
|
|
'every_page' => TRUE,
|
|
'weight' => CSS_BASE - 10,
|
|
),
|
|
),
|
|
);
|
|
|
|
// jQuery UI.
|
|
$libraries['jquery.ui.core'] = array(
|
|
'title' => 'jQuery UI: Core',
|
|
'website' => 'http://jqueryui.com',
|
|
'version' => '1.10.2',
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.ui.core.js' => array('group' => JS_LIBRARY, 'weight' => -11),
|
|
),
|
|
'css' => array(
|
|
'core/assets/vendor/jquery.ui/themes/base/jquery.ui.core.css' => array(),
|
|
'core/assets/vendor/jquery.ui/themes/base/jquery.ui.theme.css' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
),
|
|
);
|
|
$libraries['jquery.ui.accordion'] = array(
|
|
'title' => 'jQuery UI: Accordion',
|
|
'website' => 'http://jqueryui.com/demos/accordion/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.ui.accordion.js' => array(),
|
|
),
|
|
'css' => array(
|
|
'core/assets/vendor/jquery.ui/themes/base/jquery.ui.accordion.css' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.ui.core'),
|
|
array('system', 'jquery.ui.widget'),
|
|
),
|
|
);
|
|
$libraries['jquery.ui.autocomplete'] = array(
|
|
'title' => 'jQuery UI: Autocomplete',
|
|
'website' => 'http://jqueryui.com/demos/autocomplete/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.ui.autocomplete.js' => array(),
|
|
),
|
|
'css' => array(
|
|
'core/assets/vendor/jquery.ui/themes/base/jquery.ui.autocomplete.css' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.ui.core'),
|
|
array('system', 'jquery.ui.widget'),
|
|
array('system', 'jquery.ui.position'),
|
|
array('system', 'jquery.ui.menu'),
|
|
),
|
|
);
|
|
$libraries['jquery.ui.button'] = array(
|
|
'title' => 'jQuery UI: Button',
|
|
'website' => 'http://jqueryui.com/demos/button/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.ui.button.js' => array(),
|
|
),
|
|
'css' => array(
|
|
'core/assets/vendor/jquery.ui/themes/base/jquery.ui.button.css' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.ui.core'),
|
|
array('system', 'jquery.ui.widget'),
|
|
),
|
|
);
|
|
$libraries['jquery.ui.datepicker'] = array(
|
|
'title' => 'jQuery UI: Date Picker',
|
|
'website' => 'http://jqueryui.com/demos/datepicker/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.ui.datepicker.js' => array(),
|
|
),
|
|
'css' => array(
|
|
'core/assets/vendor/jquery.ui/themes/base/jquery.ui.datepicker.css' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.ui.core'),
|
|
),
|
|
);
|
|
$libraries['jquery.ui.dialog'] = array(
|
|
'title' => 'jQuery UI: Dialog',
|
|
'website' => 'http://jqueryui.com/demos/dialog/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.ui.dialog.js' => array(),
|
|
),
|
|
'css' => array(
|
|
'core/assets/vendor/jquery.ui/themes/base/jquery.ui.dialog.css' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.ui.core'),
|
|
array('system', 'jquery.ui.widget'),
|
|
array('system', 'jquery.ui.button'),
|
|
array('system', 'jquery.ui.draggable'),
|
|
array('system', 'jquery.ui.mouse'),
|
|
array('system', 'jquery.ui.position'),
|
|
array('system', 'jquery.ui.resizable'),
|
|
),
|
|
);
|
|
$libraries['jquery.ui.draggable'] = array(
|
|
'title' => 'jQuery UI: Draggable',
|
|
'website' => 'http://jqueryui.com/demos/draggable/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.ui.draggable.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.ui.core'),
|
|
array('system', 'jquery.ui.mouse'),
|
|
array('system', 'jquery.ui.widget'),
|
|
),
|
|
);
|
|
$libraries['jquery.ui.droppable'] = array(
|
|
'title' => 'jQuery UI: Droppable',
|
|
'website' => 'http://jqueryui.com/demos/droppable/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.ui.droppable.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.ui.core'),
|
|
array('system', 'jquery.ui.widget'),
|
|
array('system', 'jquery.ui.mouse'),
|
|
array('system', 'jquery.ui.draggable'),
|
|
),
|
|
);
|
|
$libraries['jquery.ui.menu'] = array(
|
|
'title' => 'jQuery UI: Mouse',
|
|
'website' => 'http://docs.jquery.com/UI/Menu',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.ui.menu.js' => array(),
|
|
),
|
|
'css' => array(
|
|
'core/assets/vendor/jquery.ui/themes/base/jquery.ui.menu.css' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.ui.core'),
|
|
array('system', 'jquery.ui.widget'),
|
|
),
|
|
);
|
|
$libraries['jquery.ui.mouse'] = array(
|
|
'title' => 'jQuery UI: Mouse',
|
|
'website' => 'http://docs.jquery.com/UI/Mouse',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.ui.mouse.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.ui.widget'),
|
|
),
|
|
);
|
|
$libraries['jquery.ui.position'] = array(
|
|
'title' => 'jQuery UI: Position',
|
|
'website' => 'http://jqueryui.com/demos/position/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.ui.position.js' => array(),
|
|
),
|
|
);
|
|
$libraries['jquery.ui.progressbar'] = array(
|
|
'title' => 'jQuery UI: Progress Bar',
|
|
'website' => 'http://jqueryui.com/demos/progressbar/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.ui.progressbar.js' => array(),
|
|
),
|
|
'css' => array(
|
|
'core/assets/vendor/jquery.ui/themes/base/jquery.ui.progressbar.css' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.ui.core'),
|
|
array('system', 'jquery.ui.widget'),
|
|
),
|
|
);
|
|
$libraries['jquery.ui.resizable'] = array(
|
|
'title' => 'jQuery UI: Resizable',
|
|
'website' => 'http://jqueryui.com/demos/resizable/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.ui.resizable.js' => array(),
|
|
),
|
|
'css' => array(
|
|
'core/assets/vendor/jquery.ui/themes/base/jquery.ui.resizable.css' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.ui.core'),
|
|
array('system', 'jquery.ui.widget'),
|
|
array('system', 'jquery.ui.mouse'),
|
|
),
|
|
);
|
|
$libraries['jquery.ui.selectable'] = array(
|
|
'title' => 'jQuery UI: Selectable',
|
|
'website' => 'http://jqueryui.com/demos/selectable/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.ui.selectable.js' => array(),
|
|
),
|
|
'css' => array(
|
|
'core/assets/vendor/jquery.ui/themes/base/jquery.ui.selectable.css' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.ui.core'),
|
|
array('system', 'jquery.ui.mouse'),
|
|
array('system', 'jquery.ui.widget'),
|
|
),
|
|
);
|
|
$libraries['jquery.ui.slider'] = array(
|
|
'title' => 'jQuery UI: Slider',
|
|
'website' => 'http://jqueryui.com/demos/slider/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.ui.slider.js' => array(),
|
|
),
|
|
'css' => array(
|
|
'core/assets/vendor/jquery.ui/themes/base/jquery.ui.slider.css' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.ui.core'),
|
|
array('system', 'jquery.ui.mouse'),
|
|
array('system', 'jquery.ui.widget'),
|
|
),
|
|
);
|
|
$libraries['jquery.ui.sortable'] = array(
|
|
'title' => 'jQuery UI: Sortable',
|
|
'website' => 'http://jqueryui.com/demos/sortable/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.ui.sortable.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.ui.core'),
|
|
array('system', 'jquery.ui.mouse'),
|
|
array('system', 'jquery.ui.widget'),
|
|
),
|
|
);
|
|
$libraries['jquery.ui.spinner'] = array(
|
|
'title' => 'jQuery UI: Spinner',
|
|
'website' => 'http://jqueryui.com/demos/spinner/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.ui.spinner.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.ui.core'),
|
|
array('system', 'jquery.ui.widget'),
|
|
array('system', 'jquery.ui.button'),
|
|
),
|
|
);
|
|
$libraries['jquery.ui.tabs'] = array(
|
|
'title' => 'jQuery UI: Tabs',
|
|
'website' => 'http://jqueryui.com/demos/tabs/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.ui.tabs.js' => array(),
|
|
),
|
|
'css' => array(
|
|
'core/assets/vendor/jquery.ui/themes/base/jquery.ui.tabs.css' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.ui.core'),
|
|
array('system', 'jquery.ui.widget'),
|
|
),
|
|
);
|
|
$libraries['jquery.ui.tooltip'] = array(
|
|
'title' => 'jQuery UI: Tooltip',
|
|
'website' => 'http://jqueryui.com/demos/tooltip/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.ui.tooltip.js' => array(),
|
|
),
|
|
'css' => array(
|
|
'core/assets/vendor/jquery.ui/themes/base/jquery.ui.tooltip.css' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.ui.core'),
|
|
array('system', 'jquery.ui.widget'),
|
|
array('system', 'jquery.ui.position'),
|
|
),
|
|
);
|
|
$libraries['jquery.ui.widget'] = array(
|
|
'title' => 'jQuery UI: Widget',
|
|
'website' => 'http://docs.jquery.com/UI/Widget',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.ui.widget.js' => array('group' => JS_LIBRARY, 'weight' => -10),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.ui.core'),
|
|
),
|
|
);
|
|
$libraries['jquery.effects.core'] = array(
|
|
'title' => 'jQuery UI: Effects',
|
|
'website' => 'http://jqueryui.com/demos/effect/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.effects.core.js' => array('group' => JS_LIBRARY, 'weight' => -9),
|
|
),
|
|
);
|
|
$libraries['jquery.effects.blind'] = array(
|
|
'title' => 'jQuery UI: Effects Blind',
|
|
'website' => 'http://jqueryui.com/demos/effect/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.effects.blind.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.effects.core'),
|
|
),
|
|
);
|
|
$libraries['jquery.effects.bounce'] = array(
|
|
'title' => 'jQuery UI: Effects Bounce',
|
|
'website' => 'http://jqueryui.com/demos/effect/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.effects.bounce.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.effects.core'),
|
|
),
|
|
);
|
|
$libraries['jquery.effects.clip'] = array(
|
|
'title' => 'jQuery UI: Effects Clip',
|
|
'website' => 'http://jqueryui.com/demos/effect/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.effects.clip.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.effects.core'),
|
|
),
|
|
);
|
|
$libraries['jquery.effects.drop'] = array(
|
|
'title' => 'jQuery UI: Effects Drop',
|
|
'website' => 'http://jqueryui.com/demos/effect/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.effects.drop.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.effects.core'),
|
|
),
|
|
);
|
|
$libraries['jquery.effects.explode'] = array(
|
|
'title' => 'jQuery UI: Effects Explode',
|
|
'website' => 'http://jqueryui.com/demos/effect/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.effects.explode.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.effects.core'),
|
|
),
|
|
);
|
|
$libraries['jquery.effects.fade'] = array(
|
|
'title' => 'jQuery UI: Effects Fade',
|
|
'website' => 'http://jqueryui.com/demos/effect/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.effects.fade.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.effects.core'),
|
|
),
|
|
);
|
|
$libraries['jquery.effects.fold'] = array(
|
|
'title' => 'jQuery UI: Effects Fold',
|
|
'website' => 'http://jqueryui.com/demos/effect/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.effects.fold.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.effects.core'),
|
|
),
|
|
);
|
|
$libraries['jquery.effects.highlight'] = array(
|
|
'title' => 'jQuery UI: Effects Highlight',
|
|
'website' => 'http://jqueryui.com/demos/effect/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.effects.highlight.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.effects.core'),
|
|
),
|
|
);
|
|
$libraries['jquery.effects.pulsate'] = array(
|
|
'title' => 'jQuery UI: Effects Pulsate',
|
|
'website' => 'http://jqueryui.com/demos/effect/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.effects.pulsate.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.effects.core'),
|
|
),
|
|
);
|
|
$libraries['jquery.effects.scale'] = array(
|
|
'title' => 'jQuery UI: Effects Scale',
|
|
'website' => 'http://jqueryui.com/demos/effect/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.effects.scale.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.effects.core'),
|
|
),
|
|
);
|
|
$libraries['jquery.effects.shake'] = array(
|
|
'title' => 'jQuery UI: Effects Shake',
|
|
'website' => 'http://jqueryui.com/demos/effect/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.effects.shake.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.effects.core'),
|
|
),
|
|
);
|
|
$libraries['jquery.effects.slide'] = array(
|
|
'title' => 'jQuery UI: Effects Slide',
|
|
'website' => 'http://jqueryui.com/demos/effect/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.effects.slide.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.effects.core'),
|
|
),
|
|
);
|
|
$libraries['jquery.effects.transfer'] = array(
|
|
'title' => 'jQuery UI: Effects Transfer',
|
|
'website' => 'http://jqueryui.com/demos/effect/',
|
|
'version' => $libraries['jquery.ui.core']['version'],
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/ui/jquery.effects.transfer.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.effects.core'),
|
|
),
|
|
);
|
|
|
|
// Touch Punch for jQuery UI touch support.
|
|
$libraries['jquery.ui.touch-punch'] = array(
|
|
'title' => 'jQuery UI Touch Punch',
|
|
'website' => 'http://jqueryui.com/demos/effect/',
|
|
'version' => '0.2.2',
|
|
'js' => array(
|
|
'core/assets/vendor/jquery-ui-touch-punch/jquery.ui.touch-punch.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery.ui.core'),
|
|
),
|
|
);
|
|
|
|
// Underscore.
|
|
$libraries['underscore'] = array(
|
|
'title' => 'Underscore.js',
|
|
'website' => 'http://underscorejs.org/',
|
|
'version' => '1.4.0',
|
|
'js' => array(
|
|
'core/assets/vendor/underscore/underscore.js' => array('group' => JS_LIBRARY, 'weight' => -20),
|
|
),
|
|
);
|
|
|
|
// Backbone.
|
|
$libraries['backbone'] = array(
|
|
'title' => 'Backbone.js',
|
|
'website' => 'http://backbonejs.org/',
|
|
'version' => '0.9.2',
|
|
'js' => array(
|
|
'core/assets/vendor/backbone/backbone.js' => array('group' => JS_LIBRARY, 'weight' => -19),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'underscore'),
|
|
),
|
|
);
|
|
|
|
// Cookie.
|
|
$libraries['jquery.cookie'] = array(
|
|
'title' => 'Cookie',
|
|
'website' => 'http://plugins.jquery.com/project/cookie',
|
|
'version' => $libraries['jquery.ui.core']['version'], // Shipped with jQuery UI.
|
|
'js' => array(
|
|
'core/assets/vendor/jquery.ui/external/jquery.cookie.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
),
|
|
);
|
|
$libraries['drupal.tableselect'] = array(
|
|
'title' => 'Tableselect',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
'core/misc/tableselect.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'drupal'),
|
|
array('system', 'jquery'),
|
|
),
|
|
);
|
|
$libraries['drupal.tableheader'] = array(
|
|
'title' => 'Table header',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
'core/misc/tableheader.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
array('system', 'drupal'),
|
|
array('system', 'drupalSettings'),
|
|
array('system', 'jquery.once'),
|
|
array('system', 'drupal.displace'),
|
|
),
|
|
);
|
|
$libraries['drupal.timezone'] = array(
|
|
'title' => 'Timezone',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
'core/misc/timezone.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
array('system', 'drupal'),
|
|
),
|
|
);
|
|
$libraries['drupal.machine-name'] = array(
|
|
'title' => 'Machine name',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
'core/misc/machine-name.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
array('system', 'jquery.once'),
|
|
array('system', 'drupal'),
|
|
array('system', 'drupalSettings'),
|
|
),
|
|
);
|
|
|
|
$libraries['drupal.system'] = array(
|
|
'title' => 'System',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
drupal_get_path('module', 'system') . '/system.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
array('system', 'drupal'),
|
|
array('system', 'drupalSettings'),
|
|
array('system', 'jquery.once'),
|
|
),
|
|
);
|
|
$libraries['drupal.system.modules'] = array(
|
|
'title' => 'System modules',
|
|
'version' => VERSION,
|
|
'js' => array(
|
|
drupal_get_path('module', 'system') . '/system.modules.js' => array(),
|
|
),
|
|
'dependencies' => array(
|
|
array('system', 'jquery'),
|
|
array('system', 'drupal'),
|
|
array('system', 'jquery.once'),
|
|
),
|
|
);
|
|
|
|
return $libraries;
|
|
}
|
|
|
|
/**
|
|
* Implements hook_stream_wrappers().
|
|
*/
|
|
function system_stream_wrappers() {
|
|
$wrappers = array(
|
|
'public' => array(
|
|
'name' => t('Public files'),
|
|
'class' => 'Drupal\Core\StreamWrapper\PublicStream',
|
|
'description' => t('Public local files served by the webserver.'),
|
|
'type' => STREAM_WRAPPERS_LOCAL_NORMAL,
|
|
),
|
|
'temporary' => array(
|
|
'name' => t('Temporary files'),
|
|
'class' => 'Drupal\Core\StreamWrapper\TemporaryStream',
|
|
'description' => t('Temporary local files for upload and previews.'),
|
|
'type' => STREAM_WRAPPERS_LOCAL_HIDDEN,
|
|
),
|
|
);
|
|
|
|
// Only register the private file stream wrapper if a file path has been set.
|
|
if (Drupal::config('system.file')->get('path.private')) {
|
|
$wrappers['private'] = array(
|
|
'name' => t('Private files'),
|
|
'class' => 'Drupal\Core\StreamWrapper\PrivateStream',
|
|
'description' => t('Private local files served by Drupal.'),
|
|
'type' => STREAM_WRAPPERS_LOCAL_NORMAL,
|
|
);
|
|
}
|
|
|
|
return $wrappers;
|
|
}
|
|
|
|
/**
|
|
* Menu item access callback - only enabled themes can be accessed.
|
|
*/
|
|
function _system_themes_access($theme) {
|
|
return user_access('administer themes') && drupal_theme_access($theme);
|
|
}
|
|
|
|
/**
|
|
* @defgroup authorize Authorized operations
|
|
* @{
|
|
* Functions to run operations with elevated privileges via authorize.php.
|
|
*
|
|
* Because of the Update manager functionality included in Drupal core, there
|
|
* is a mechanism for running operations with elevated file system privileges,
|
|
* the top-level authorize.php script. This script runs at a reduced Drupal
|
|
* bootstrap level so that it is not reliant on the entire site being
|
|
* functional. The operations use a FileTransfer class to manipulate code
|
|
* installed on the system as the user that owns the files, not the user that
|
|
* the httpd is running as.
|
|
*
|
|
* The first setup is to define a callback function that should be authorized
|
|
* to run with the elevated privileges. This callback should take a
|
|
* FileTransfer as its first argument, although you can define an array of
|
|
* other arguments it should be invoked with. The callback should be placed in
|
|
* a separate .inc file that will be included by authorize.php.
|
|
*
|
|
* To run the operation, certain data must be saved into the SESSION, and then
|
|
* the flow of control should be redirected to the authorize.php script. There
|
|
* are two ways to do this, either to call system_authorized_run() directly,
|
|
* or to call system_authorized_init() and then redirect to authorize.php,
|
|
* using the URL from system_authorized_get_url(). Redirecting yourself is
|
|
* necessary when your authorized operation is being triggered by a form
|
|
* submit handler, since calling redirecting in a submit handler is a bad
|
|
* idea, and you should instead set $form_state['redirect'].
|
|
*
|
|
* Once the SESSION is setup for the operation and the user is redirected to
|
|
* authorize.php, they will be prompted for their connection credentials (core
|
|
* provides FTP and SSH by default, although other connection classes can be
|
|
* added via contributed modules). With valid credentials, authorize.php will
|
|
* instantiate the appropriate FileTransfer object, and then invoke the
|
|
* desired operation passing in that object. The authorize.php script can act
|
|
* as a Batch API processing page, if the operation requires a batch.
|
|
*
|
|
* @see authorize.php
|
|
* @see Drupal\Core\FileTransfer\FileTransfer
|
|
* @see hook_filetransfer_info()
|
|
*/
|
|
|
|
/**
|
|
* Setup a given callback to run via authorize.php with elevated privileges.
|
|
*
|
|
* To use authorize.php, certain variables must be stashed into $_SESSION. This
|
|
* function sets up all the necessary $_SESSION variables. The calling function
|
|
* should then redirect to authorize.php, using the full path returned by
|
|
* system_authorized_get_url(). That initiates the workflow that will eventually
|
|
* lead to the callback being invoked. The callback will be invoked at a low
|
|
* bootstrap level, without all modules being invoked, so it needs to be careful
|
|
* not to assume any code exists. Example (system_authorized_run()):
|
|
* @code
|
|
* system_authorized_init($callback, $file, $arguments, $page_title);
|
|
* return new RedirectResponse(system_authorized_get_url());
|
|
* @endcode
|
|
* Example (update_manager_install_form_submit()):
|
|
* @code
|
|
* system_authorized_init('update_authorize_run_install',
|
|
* drupal_get_path('module', 'update') . '/update.authorize.inc',
|
|
* $arguments, t('Update manager'));
|
|
* $form_state['redirect'] = system_authorized_get_url();
|
|
* @endcode
|
|
*
|
|
* @param $callback
|
|
* The name of the function to invoke once the user authorizes the operation.
|
|
* @param $file
|
|
* The full path to the file where the callback function is implemented.
|
|
* @param $arguments
|
|
* Optional array of arguments to pass into the callback when it is invoked.
|
|
* Note that the first argument to the callback is always the FileTransfer
|
|
* object created by authorize.php when the user authorizes the operation.
|
|
* @param $page_title
|
|
* Optional string to use as the page title once redirected to authorize.php.
|
|
* @return
|
|
* Nothing, this function just initializes variables in the user's session.
|
|
*/
|
|
function system_authorized_init($callback, $file, $arguments = array(), $page_title = NULL) {
|
|
// First, figure out what file transfer backends the site supports, and put
|
|
// all of those in the SESSION so that authorize.php has access to all of
|
|
// them via the class autoloader, even without a full bootstrap.
|
|
$_SESSION['authorize_filetransfer_info'] = drupal_get_filetransfer_info();
|
|
|
|
// Now, define the callback to invoke.
|
|
$_SESSION['authorize_operation'] = array(
|
|
'callback' => $callback,
|
|
'file' => $file,
|
|
'arguments' => $arguments,
|
|
);
|
|
|
|
if (isset($page_title)) {
|
|
$_SESSION['authorize_operation']['page_title'] = $page_title;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Return the URL for the authorize.php script.
|
|
*
|
|
* @param array $options
|
|
* Optional array of options to pass to url().
|
|
* @return
|
|
* The full URL to authorize.php, using HTTPS if available.
|
|
*
|
|
* @see system_authorized_init()
|
|
*/
|
|
function system_authorized_get_url(array $options = array()) {
|
|
global $base_url;
|
|
// Force HTTPS if available, regardless of what the caller specifies.
|
|
$options['https'] = TRUE;
|
|
// Prefix with $base_url so url() treats it as an external link.
|
|
return url($base_url . '/core/authorize.php', $options);
|
|
}
|
|
|
|
/**
|
|
* Returns the URL for the authorize.php script when it is processing a batch.
|
|
*
|
|
* @param array $options
|
|
* Optional array of options to pass to url().
|
|
*/
|
|
function system_authorized_batch_processing_url(array $options = array()) {
|
|
$options['query'] = array('batch' => '1');
|
|
return system_authorized_get_url($options);
|
|
}
|
|
|
|
/**
|
|
* Setup and invoke an operation using authorize.php.
|
|
*
|
|
* @see system_authorized_init()
|
|
*/
|
|
function system_authorized_run($callback, $file, $arguments = array(), $page_title = NULL) {
|
|
system_authorized_init($callback, $file, $arguments, $page_title);
|
|
return new RedirectResponse(system_authorized_get_url());
|
|
}
|
|
|
|
/**
|
|
* Use authorize.php to run batch_process().
|
|
*
|
|
* @see batch_process()
|
|
*/
|
|
function system_authorized_batch_process() {
|
|
$finish_url = system_authorized_get_url();
|
|
$process_url = system_authorized_batch_processing_url();
|
|
return batch_process($finish_url, $process_url);
|
|
}
|
|
|
|
/**
|
|
* @} End of "defgroup authorize".
|
|
*/
|
|
|
|
/**
|
|
* Implements hook_updater_info().
|
|
*/
|
|
function system_updater_info() {
|
|
return array(
|
|
'module' => array(
|
|
'class' => 'Drupal\Core\Updater\Module',
|
|
'name' => t('Update modules'),
|
|
'weight' => 0,
|
|
),
|
|
'theme' => array(
|
|
'class' => 'Drupal\Core\Updater\Theme',
|
|
'name' => t('Update themes'),
|
|
'weight' => 0,
|
|
),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Implements hook_filetransfer_info().
|
|
*/
|
|
function system_filetransfer_info() {
|
|
$backends = array();
|
|
|
|
// This is the default, will be available on most systems.
|
|
if (function_exists('ftp_connect')) {
|
|
$backends['ftp'] = array(
|
|
'title' => t('FTP'),
|
|
'class' => 'Drupal\Core\FileTransfer\FTP',
|
|
'weight' => 0,
|
|
);
|
|
}
|
|
|
|
// SSH2 lib connection is only available if the proper PHP extension is
|
|
// installed.
|
|
if (function_exists('ssh2_connect')) {
|
|
$backends['ssh'] = array(
|
|
'title' => t('SSH'),
|
|
'class' => 'Drupal\Core\FileTransfer\SSH',
|
|
'weight' => 20,
|
|
);
|
|
}
|
|
return $backends;
|
|
}
|
|
|
|
/**
|
|
* Implements hook_page_build().
|
|
*/
|
|
function system_page_build(&$page) {
|
|
// Note: ensure the same CSS is loaded in _drupal_maintenance_theme().
|
|
$page['#attached']['library'][] = array('system', 'drupal.base');
|
|
$path = drupal_get_path('module', 'system');
|
|
// Adjust the weights to load these early.
|
|
$page['#attached']['css'][$path . '/css/system.module.css'] = array('weight' => CSS_COMPONENT - 10, 'every_page' => TRUE);
|
|
$page['#attached']['css'][$path . '/css/system.theme.css'] = array('weight' => CSS_SKIN - 10, 'every_page' => TRUE);
|
|
if (path_is_admin(current_path())) {
|
|
$page['#attached']['css'][$path . '/css/system.admin.css'] = array('weight' => CSS_COMPONENT - 10);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Implements hook_custom_theme().
|
|
*/
|
|
function system_custom_theme() {
|
|
if (drupal_container()->isScopeActive('request')) {
|
|
$request = drupal_container()->get('request');
|
|
$path = $request->attributes->get('_system_path');
|
|
if (user_access('view the administration theme') && path_is_admin($path)) {
|
|
return Drupal::config('system.theme')->get('admin');
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Implements hook_form_FORM_ID_alter().
|
|
*/
|
|
function system_form_user_form_alter(&$form, &$form_state) {
|
|
if (Drupal::config('system.date')->get('timezone.user.configurable')) {
|
|
system_user_timezone($form, $form_state);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Implements hook_form_FORM_ID_alter().
|
|
*/
|
|
function system_form_user_register_form_alter(&$form, &$form_state) {
|
|
$config = Drupal::config('system.date');
|
|
if ($config->get('timezone.user.configurable') && $config->get('timezone.user.default') == DRUPAL_USER_TIMEZONE_SELECT) {
|
|
system_user_timezone($form, $form_state);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Implements hook_user_presave().
|
|
*/
|
|
function system_user_presave(UserInterface $account) {
|
|
$config = Drupal::config('system.date');
|
|
if ($config->get('timezone.user.configurable') && !$account->getTimeZone() && !$config->get('timezone.user.default')) {
|
|
$account->timezone = $config->get('timezone.default');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Implements hook_user_login().
|
|
*/
|
|
function system_user_login($account) {
|
|
$config = Drupal::config('system.date');
|
|
// If the user has a NULL time zone, notify them to set a time zone.
|
|
if (!$account->getTimezone() && $config->get('timezone.user.configurable') && $config->get('timezone.user.warn')) {
|
|
drupal_set_message(t('Configure your <a href="@user-edit">account time zone setting</a>.', array('@user-edit' => url("user/$account->id()/edit", array('query' => drupal_get_destination(), 'fragment' => 'edit-timezone')))));
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Add the time zone field to the user edit and register forms.
|
|
*/
|
|
function system_user_timezone(&$form, &$form_state) {
|
|
global $user;
|
|
|
|
$account = $form_state['controller']->getEntity();
|
|
$form['timezone'] = array(
|
|
'#type' => 'details',
|
|
'#title' => t('Locale settings'),
|
|
'#weight' => 6,
|
|
);
|
|
$form['timezone']['timezone'] = array(
|
|
'#type' => 'select',
|
|
'#title' => t('Time zone'),
|
|
'#default_value' => $account->getTimezone() ? $account->getTimezone() : Drupal::config('system.date')->get('timezone.default'),
|
|
'#options' => system_time_zones($account->id() != $user->id()),
|
|
'#description' => t('Select the desired local time and time zone. Dates and times throughout this site will be displayed using this time zone.'),
|
|
);
|
|
if (!$account->getTimezone() && $account->id() == $user->id() && empty($form_state['input']['timezone'])) {
|
|
$form['timezone']['#description'] = t('Your time zone setting will be automatically detected if possible. Confirm the selection and click save.');
|
|
$form['timezone']['timezone']['#attributes'] = array('class' => array('timezone-detect'));
|
|
drupal_add_library('system', 'drupal.timezone');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Implements hook_preprocess_HOOK() for block.html.twig.
|
|
*/
|
|
function system_preprocess_block(&$variables) {
|
|
// Derive the base plugin ID.
|
|
list($plugin_id) = explode(':', $variables['plugin_id'] . ':');
|
|
switch ($plugin_id) {
|
|
case 'system_powered_by_block':
|
|
$variables['attributes']['role'] = 'complementary';
|
|
break;
|
|
case 'system_help_block':
|
|
$variables['attributes']['role'] = 'complementary';
|
|
break;
|
|
case 'system_menu_block':
|
|
$variables['attributes']['role'] = 'navigation';
|
|
$variables['attributes']['class'][] = 'block-menu';
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Provide a single block on the administration overview page.
|
|
*
|
|
* @param $item
|
|
* The menu item to be displayed.
|
|
*/
|
|
function system_admin_menu_block($item) {
|
|
$cache = &drupal_static(__FUNCTION__, array());
|
|
// If we are calling this function for a menu item that corresponds to a
|
|
// local task (for example, admin/tasks), then we want to retrieve the
|
|
// parent item's child links, not this item's (since this item won't have
|
|
// any).
|
|
if ($item['tab_root'] != $item['path']) {
|
|
$item = menu_get_item($item['tab_root_href']);
|
|
}
|
|
|
|
if (!isset($item['mlid'])) {
|
|
$menu_links = entity_load_multiple_by_properties('menu_link', array('router_path' => $item['path'], 'module' => 'system'));
|
|
$menu_link = reset($menu_links);
|
|
$item['mlid'] = $menu_link->id();
|
|
$item['menu_name'] = $menu_link->menu_name;
|
|
}
|
|
|
|
if (isset($cache[$item['mlid']])) {
|
|
return $cache[$item['mlid']];
|
|
}
|
|
|
|
$content = array();
|
|
$menu_links = entity_load_multiple_by_properties('menu_link', array('plid' => $item['mlid'], 'menu_name' => $item['menu_name'], 'hidden' => 0));
|
|
foreach ($menu_links as $link) {
|
|
_menu_link_translate($link);
|
|
if ($link['access']) {
|
|
// The link description, either derived from 'description' in
|
|
// hook_menu() or customized via menu module is used as title attribute.
|
|
if (!empty($link['localized_options']['attributes']['title'])) {
|
|
$link['description'] = $link['localized_options']['attributes']['title'];
|
|
unset($link['localized_options']['attributes']['title']);
|
|
}
|
|
// Prepare for sorting as in function _menu_tree_check_access().
|
|
// The weight is offset so it is always positive, with a uniform 5-digits.
|
|
$key = (50000 + $link['weight']) . ' ' . drupal_strtolower($link['title']) . ' ' . $link['mlid'];
|
|
$content[$key] = $link;
|
|
}
|
|
}
|
|
ksort($content);
|
|
$cache[$item['mlid']] = $content;
|
|
return $content;
|
|
}
|
|
|
|
/**
|
|
* Checks the existence of the directory specified in $form_element.
|
|
*
|
|
* This function is called from the system_settings form to check all core
|
|
* file directories (file_public_path, file_private_path, file_temporary_path).
|
|
*
|
|
* @param $form_element
|
|
* The form element containing the name of the directory to check.
|
|
*/
|
|
function system_check_directory($form_element) {
|
|
$directory = $form_element['#value'];
|
|
if (strlen($directory) == 0) {
|
|
return $form_element;
|
|
}
|
|
|
|
if (!is_dir($directory) && !drupal_mkdir($directory, NULL, TRUE)) {
|
|
// If the directory does not exists and cannot be created.
|
|
form_set_error($form_element['#parents'][0], t('The directory %directory does not exist and could not be created.', array('%directory' => $directory)));
|
|
watchdog('file system', 'The directory %directory does not exist and could not be created.', array('%directory' => $directory), WATCHDOG_ERROR);
|
|
}
|
|
|
|
if (is_dir($directory) && !is_writable($directory) && !drupal_chmod($directory)) {
|
|
// If the directory is not writable and cannot be made so.
|
|
form_set_error($form_element['#parents'][0], t('The directory %directory exists but is not writable and could not be made writable.', array('%directory' => $directory)));
|
|
watchdog('file system', 'The directory %directory exists but is not writable and could not be made writable.', array('%directory' => $directory), WATCHDOG_ERROR);
|
|
}
|
|
elseif (is_dir($directory)) {
|
|
if ($form_element['#name'] == 'file_public_path') {
|
|
// Create public .htaccess file.
|
|
file_save_htaccess($directory, FALSE);
|
|
}
|
|
else {
|
|
// Create private .htaccess file.
|
|
file_save_htaccess($directory);
|
|
}
|
|
}
|
|
|
|
return $form_element;
|
|
}
|
|
|
|
/**
|
|
* Returns an array of information about enabled modules or themes.
|
|
*
|
|
* This function returns the contents of the .info.yml file for each enabled
|
|
* module or theme.
|
|
*
|
|
* @param $type
|
|
* Either 'module' or 'theme'.
|
|
* @param $name
|
|
* (optional) The name of a module or theme whose information shall be
|
|
* returned. If omitted, all records for the provided $type will be returned.
|
|
* If $name does not exist in the provided $type or is not enabled, an empty
|
|
* array will be returned.
|
|
*
|
|
* @return
|
|
* An associative array of module or theme information keyed by name, or only
|
|
* information for $name, if given. If no records are available, an empty
|
|
* array is returned.
|
|
*
|
|
* @see system_rebuild_module_data()
|
|
* @see system_rebuild_theme_data()
|
|
*/
|
|
function system_get_info($type, $name = NULL) {
|
|
$info = array();
|
|
if ($type == 'module') {
|
|
$data = system_rebuild_module_data();
|
|
foreach (Drupal::moduleHandler()->getModuleList() as $module => $filename) {
|
|
$info[$module] = $data[$module]->info;
|
|
}
|
|
}
|
|
else {
|
|
$list = system_list($type);
|
|
foreach ($list as $shortname => $item) {
|
|
if (!empty($item->status)) {
|
|
$info[$shortname] = $item->info;
|
|
}
|
|
}
|
|
}
|
|
if (isset($name)) {
|
|
return isset($info[$name]) ? $info[$name] : array();
|
|
}
|
|
return $info;
|
|
}
|
|
|
|
/**
|
|
* Return .info.yml data for modules.
|
|
*
|
|
* @param string $property
|
|
* The .info.yml property to retrieve.
|
|
*
|
|
* @return array
|
|
* An array keyed by module name, with the .info.yml file property as values.
|
|
* Only modules with the property specified in their .info.yml file will be
|
|
* returned.
|
|
*
|
|
* @see Drupal\Core\Utility\ModuleInfo
|
|
*/
|
|
function system_get_module_info($property) {
|
|
static $info;
|
|
if (!isset($info)) {
|
|
$info = new ModuleInfo('system_info', 'cache');
|
|
}
|
|
return $info[$property];
|
|
}
|
|
|
|
/**
|
|
* Helper function to scan and collect module .info.yml data.
|
|
*
|
|
* @return
|
|
* An associative array of module information.
|
|
*/
|
|
function _system_rebuild_module_data() {
|
|
// Find modules
|
|
$modules = drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.module$/', 'modules', 'name', 0);
|
|
|
|
// Find installation profiles.
|
|
$profiles = drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.profile$/', 'profiles', 'name', 0);
|
|
|
|
// Include the installation profile in modules that are loaded.
|
|
$profile = drupal_get_profile();
|
|
$modules[$profile] = $profiles[$profile];
|
|
|
|
// Installation profile hooks are always executed last.
|
|
$modules[$profile]->weight = 1000;
|
|
|
|
// Set defaults for module info.
|
|
$defaults = array(
|
|
'dependencies' => array(),
|
|
'description' => '',
|
|
'package' => 'Other',
|
|
'version' => NULL,
|
|
'php' => DRUPAL_MINIMUM_PHP,
|
|
'files' => array(),
|
|
);
|
|
|
|
// Read info files for each module.
|
|
foreach ($modules as $key => $module) {
|
|
// The module system uses the key 'filename' instead of 'uri' so copy the
|
|
// value so it will be used by the modules system.
|
|
$modules[$key]->filename = $module->uri;
|
|
|
|
// Look for the info file.
|
|
$module->info = drupal_parse_info_file(dirname($module->uri) . '/' . $module->name . '.info.yml');
|
|
|
|
// Skip modules/profiles that don't provide info or have the wrong type.
|
|
if (empty($module->info) || !isset($module->info['type']) || !in_array($module->info['type'], array('module', 'profile'))) {
|
|
unset($modules[$key]);
|
|
continue;
|
|
}
|
|
|
|
// Add the info file modification time, so it becomes available for
|
|
// contributed modules to use for ordering module lists.
|
|
$module->info['mtime'] = filemtime(dirname($module->uri) . '/' . $module->name . '.info.yml');
|
|
|
|
// Merge in defaults and save.
|
|
$modules[$key]->info = $module->info + $defaults;
|
|
|
|
// Installation profiles are hidden by default, unless explicitly specified
|
|
// otherwise in the .info.yml file.
|
|
if ($key == $profile && !isset($modules[$key]->info['hidden'])) {
|
|
$modules[$key]->info['hidden'] = TRUE;
|
|
}
|
|
|
|
// Invoke hook_system_info_alter() to give installed modules a chance to
|
|
// modify the data in the .info.yml files if necessary.
|
|
$type = 'module';
|
|
drupal_alter('system_info', $modules[$key]->info, $modules[$key], $type);
|
|
}
|
|
|
|
if (isset($modules[$profile])) {
|
|
// The installation profile is required, if it's a valid module.
|
|
$modules[$profile]->info['required'] = TRUE;
|
|
// Add a default distribution name if the profile did not provide one. This
|
|
// matches the default value used in install_profile_info().
|
|
if (!isset($modules[$profile]->info['distribution_name'])) {
|
|
$modules[$profile]->info['distribution_name'] = 'Drupal';
|
|
}
|
|
}
|
|
|
|
return $modules;
|
|
}
|
|
|
|
/**
|
|
* Rebuild, save, and return data about all currently available modules.
|
|
*
|
|
* @return
|
|
* Array of all available modules and their data.
|
|
*/
|
|
function system_rebuild_module_data() {
|
|
$modules_cache = &drupal_static(__FUNCTION__);
|
|
// Only rebuild once per request. $modules and $modules_cache cannot be
|
|
// combined into one variable, because the $modules_cache variable is reset by
|
|
// reference from system_list_reset() during the rebuild.
|
|
if (!isset($modules_cache)) {
|
|
$modules = _system_rebuild_module_data();
|
|
$files = array();
|
|
ksort($modules);
|
|
// Add name, status, weight, and schema version.
|
|
$enabled_modules = (array) Drupal::config('system.module')->get('enabled');
|
|
$disabled_modules = (array) Drupal::config('system.module.disabled')->get();
|
|
$all_modules = $enabled_modules + $disabled_modules;
|
|
foreach ($modules as $module => $record) {
|
|
$record->name = $module;
|
|
$record->weight = isset($all_modules[$module]) ? $all_modules[$module] : 0;
|
|
$record->status = (int) isset($enabled_modules[$module]);
|
|
$record->schema_version = SCHEMA_UNINSTALLED;
|
|
$files[$module] = $record->filename;
|
|
}
|
|
$modules = Drupal::moduleHandler()->buildModuleDependencies($modules);
|
|
$modules_cache = $modules;
|
|
|
|
// Store filenames to allow system_list() and drupal_get_filename() to
|
|
// retrieve them without having to rebuild or scan the filesystem.
|
|
Drupal::state()->set('system.module.files', $files);
|
|
}
|
|
return $modules_cache;
|
|
}
|
|
|
|
/**
|
|
* Helper function to scan and collect theme .info.yml data and their engines.
|
|
*
|
|
* @return
|
|
* An associative array of themes information.
|
|
*/
|
|
function _system_rebuild_theme_data() {
|
|
// Find themes
|
|
$themes = drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.info.yml$/', 'themes');
|
|
// Allow modules to add further themes.
|
|
if ($module_themes = Drupal::moduleHandler()->invokeAll('system_theme_info')) {
|
|
foreach ($module_themes as $name => $uri) {
|
|
// @see file_scan_directory()
|
|
$themes[$name] = (object) array(
|
|
'uri' => $uri,
|
|
'filename' => pathinfo($uri, PATHINFO_FILENAME),
|
|
'name' => $name,
|
|
);
|
|
}
|
|
}
|
|
|
|
// Find theme engines
|
|
$engines = drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.engine$/', 'themes/engines');
|
|
|
|
// Set defaults for theme info.
|
|
$defaults = array(
|
|
'engine' => 'twig',
|
|
'regions' => array(
|
|
'sidebar_first' => 'Left sidebar',
|
|
'sidebar_second' => 'Right sidebar',
|
|
'content' => 'Content',
|
|
'header' => 'Header',
|
|
'footer' => 'Footer',
|
|
'highlighted' => 'Highlighted',
|
|
'help' => 'Help',
|
|
'page_top' => 'Page top',
|
|
'page_bottom' => 'Page bottom',
|
|
),
|
|
'description' => '',
|
|
'features' => _system_default_theme_features(),
|
|
'screenshot' => 'screenshot.png',
|
|
'php' => DRUPAL_MINIMUM_PHP,
|
|
'stylesheets' => array(),
|
|
'scripts' => array(),
|
|
);
|
|
|
|
$sub_themes = array();
|
|
// Read info files for each theme
|
|
foreach ($themes as $key => $theme) {
|
|
$themes[$key]->filename = $theme->uri;
|
|
$themes[$key]->info = drupal_parse_info_file($theme->uri) + $defaults;
|
|
|
|
// Skip this extension if its type is not theme.
|
|
if (!isset($themes[$key]->info['type']) || $themes[$key]->info['type'] != 'theme') {
|
|
unset($themes[$key]);
|
|
continue;
|
|
}
|
|
|
|
// Add the info file modification time, so it becomes available for
|
|
// contributed modules to use for ordering theme lists.
|
|
$themes[$key]->info['mtime'] = filemtime($theme->uri);
|
|
|
|
// Invoke hook_system_info_alter() to give installed modules a chance to
|
|
// modify the data in the .info.yml files if necessary.
|
|
$type = 'theme';
|
|
drupal_alter('system_info', $themes[$key]->info, $themes[$key], $type);
|
|
|
|
if (!empty($themes[$key]->info['base theme'])) {
|
|
$sub_themes[] = $key;
|
|
}
|
|
|
|
$engine = $themes[$key]->info['engine'];
|
|
if (isset($engines[$engine])) {
|
|
$themes[$key]->owner = $engines[$engine]->uri;
|
|
$themes[$key]->prefix = $engines[$engine]->name;
|
|
$themes[$key]->template = TRUE;
|
|
}
|
|
|
|
// Prefix stylesheets and scripts with module path.
|
|
$path = dirname($theme->uri);
|
|
$theme->info['stylesheets'] = _system_info_add_path($theme->info['stylesheets'], $path);
|
|
$theme->info['scripts'] = _system_info_add_path($theme->info['scripts'], $path);
|
|
|
|
// Give the screenshot proper path information.
|
|
if (!empty($themes[$key]->info['screenshot'])) {
|
|
$themes[$key]->info['screenshot'] = $path . '/' . $themes[$key]->info['screenshot'];
|
|
}
|
|
}
|
|
|
|
// Now that we've established all our master themes, go back and fill in data
|
|
// for subthemes.
|
|
foreach ($sub_themes as $key) {
|
|
$themes[$key]->base_themes = drupal_find_base_themes($themes, $key);
|
|
// Don't proceed if there was a problem with the root base theme.
|
|
if (!current($themes[$key]->base_themes)) {
|
|
continue;
|
|
}
|
|
$base_key = key($themes[$key]->base_themes);
|
|
foreach (array_keys($themes[$key]->base_themes) as $base_theme) {
|
|
$themes[$base_theme]->sub_themes[$key] = $themes[$key]->info['name'];
|
|
}
|
|
// Copy the 'owner' and 'engine' over if the top level theme uses a theme
|
|
// engine.
|
|
if (isset($themes[$base_key]->owner)) {
|
|
if (isset($themes[$base_key]->info['engine'])) {
|
|
$themes[$key]->info['engine'] = $themes[$base_key]->info['engine'];
|
|
$themes[$key]->owner = $themes[$base_key]->owner;
|
|
$themes[$key]->prefix = $themes[$base_key]->prefix;
|
|
}
|
|
else {
|
|
$themes[$key]->prefix = $key;
|
|
}
|
|
}
|
|
}
|
|
|
|
return $themes;
|
|
}
|
|
|
|
/**
|
|
* Rebuild, save, and return data about all currently available themes.
|
|
*
|
|
* @return
|
|
* Array of all available themes and their data.
|
|
*/
|
|
function system_rebuild_theme_data() {
|
|
$themes = _system_rebuild_theme_data();
|
|
ksort($themes);
|
|
// @todo This function has no business in determining/setting the status of
|
|
// a theme, but various other functions expect it to return themes with a
|
|
// $status property. system_list() stores the return value of this function
|
|
// in state, and ensures to set/override the $status property for each theme
|
|
// based on the current config. Remove this code when themes have a proper
|
|
// installation status.
|
|
// @see http://drupal.org/node/1067408
|
|
$enabled_themes = (array) Drupal::config('system.theme')->get('enabled');
|
|
$files = array();
|
|
foreach ($themes as $name => $theme) {
|
|
$theme->status = (int) isset($enabled_themes[$name]);
|
|
$files[$name] = $theme->filename;
|
|
}
|
|
// Replace last known theme data state.
|
|
// @todo Obsolete with proper installation status for themes.
|
|
Drupal::state()->set('system.theme.data', $themes);
|
|
|
|
// Store filenames to allow system_list() and drupal_get_filename() to
|
|
// retrieve them without having to rebuild or scan the filesystem.
|
|
Drupal::state()->set('system.theme.files', $files);
|
|
|
|
return $themes;
|
|
}
|
|
|
|
/**
|
|
* Prefixes all values in an .info.yml file array with a given path.
|
|
*
|
|
* This helper function is mainly used to prefix all array values of an
|
|
* .info.yml file property with a single given path (to the module or theme);
|
|
* e.g., to prefix all values of the 'stylesheets' or 'scripts' properties with
|
|
* the file path to the defining module/theme.
|
|
*
|
|
* @param $info
|
|
* A nested array of data of an .info.yml file to be processed.
|
|
* @param $path
|
|
* A file path to prepend to each value in $info.
|
|
*
|
|
* @return
|
|
* The $info array with prefixed values.
|
|
*
|
|
* @see _system_rebuild_module_data()
|
|
* @see _system_rebuild_theme_data()
|
|
*/
|
|
function _system_info_add_path($info, $path) {
|
|
foreach ($info as $key => $value) {
|
|
// Recurse into nested values until we reach the deepest level.
|
|
if (is_array($value)) {
|
|
$info[$key] = _system_info_add_path($info[$key], $path);
|
|
}
|
|
// Unset the original value's key and set the new value with prefix, using
|
|
// the original value as key, so original values can still be looked up.
|
|
else {
|
|
unset($info[$key]);
|
|
$info[$value] = $path . '/' . $value;
|
|
}
|
|
}
|
|
return $info;
|
|
}
|
|
|
|
/**
|
|
* Returns an array of default theme features.
|
|
*/
|
|
function _system_default_theme_features() {
|
|
return array(
|
|
'logo',
|
|
'favicon',
|
|
'name',
|
|
'slogan',
|
|
'node_user_picture',
|
|
'comment_user_picture',
|
|
'comment_user_verification',
|
|
'main_menu',
|
|
'secondary_menu',
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get a list of available regions from a specified theme.
|
|
*
|
|
* @param $theme_key
|
|
* The name of a theme.
|
|
* @param $show
|
|
* Possible values: REGIONS_ALL or REGIONS_VISIBLE. Visible excludes hidden
|
|
* regions.
|
|
* @return
|
|
* An array of regions in the form $region['name'] = 'description'.
|
|
*/
|
|
function system_region_list($theme_key, $show = REGIONS_ALL) {
|
|
$themes = list_themes();
|
|
if (!isset($themes[$theme_key])) {
|
|
return array();
|
|
}
|
|
|
|
$list = array();
|
|
$info = $themes[$theme_key]->info;
|
|
// If requested, suppress hidden regions. See block_admin_display_form().
|
|
foreach ($info['regions'] as $name => $label) {
|
|
if ($show == REGIONS_ALL || !isset($info['regions_hidden']) || !in_array($name, $info['regions_hidden'])) {
|
|
$list[$name] = t($label);
|
|
}
|
|
}
|
|
|
|
return $list;
|
|
}
|
|
|
|
/**
|
|
* Implements hook_system_info_alter().
|
|
*/
|
|
function system_system_info_alter(&$info, $file, $type) {
|
|
// Remove page-top and page-bottom from the blocks UI since they are reserved for
|
|
// modules to populate from outside the blocks system.
|
|
if ($type == 'theme') {
|
|
$info['regions_hidden'][] = 'page_top';
|
|
$info['regions_hidden'][] = 'page_bottom';
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Gets the name of the default region for a given theme.
|
|
*
|
|
* @param $theme
|
|
* The name of a theme.
|
|
* @return
|
|
* A string that is the region name.
|
|
*/
|
|
function system_default_region($theme) {
|
|
$regions = array_keys(system_region_list($theme, REGIONS_VISIBLE));
|
|
return isset($regions[0]) ? $regions[0] : '';
|
|
}
|
|
|
|
/**
|
|
* Generates a form array for a confirmation form.
|
|
*
|
|
* This function returns a complete form array for confirming an action. The
|
|
* form contains a confirm button as well as a cancellation link that allows a
|
|
* user to abort the action.
|
|
*
|
|
* If the submit handler for a form that implements confirm_form() is invoked,
|
|
* the user successfully confirmed the action. You should never directly
|
|
* inspect $_POST to see if an action was confirmed.
|
|
*
|
|
* Note - if the parameters $question, $description, $yes, or $no could contain
|
|
* any user input (such as node titles or taxonomy terms), it is the
|
|
* responsibility of the code calling confirm_form() to sanitize them first with
|
|
* a function like check_plain() or filter_xss().
|
|
*
|
|
* @param $form
|
|
* Additional elements to add to the form. These can be regular form elements,
|
|
* #value elements, etc., and their values will be available to the submit
|
|
* handler.
|
|
* @param $question
|
|
* The question to ask the user (e.g. "Are you sure you want to delete the
|
|
* block <em>foo</em>?"). The page title will be set to this value.
|
|
* @param $path
|
|
* The page to go to if the user cancels the action. This can be either:
|
|
* - A string containing a Drupal path.
|
|
* - An associative array with a 'path' key. Additional array values are
|
|
* passed as the $options parameter to l().
|
|
* If the 'destination' query parameter is set in the URL when viewing a
|
|
* confirmation form, that value will be used instead of $path.
|
|
* @param $description
|
|
* Additional text to display. Defaults to t('This action cannot be undone.').
|
|
* @param $yes
|
|
* A caption for the button that confirms the action (e.g. "Delete",
|
|
* "Replace", ...). Defaults to t('Confirm').
|
|
* @param $no
|
|
* A caption for the link which cancels the action (e.g. "Cancel"). Defaults
|
|
* to t('Cancel').
|
|
* @param $name
|
|
* The internal name used to refer to the confirmation item.
|
|
*
|
|
* @return
|
|
* The form array.
|
|
*
|
|
* @deprecated Use \Drupal\Core\Form\ConfirmFormBase instead.
|
|
*/
|
|
function confirm_form($form, $question, $path, $description = NULL, $yes = NULL, $no = NULL, $name = 'confirm') {
|
|
$description = isset($description) ? $description : t('This action cannot be undone.');
|
|
|
|
// Prepare cancel link.
|
|
if (isset($_GET['destination'])) {
|
|
$options = drupal_parse_url($_GET['destination']);
|
|
}
|
|
elseif (is_array($path)) {
|
|
$options = $path;
|
|
}
|
|
else {
|
|
$options = array('path' => $path);
|
|
}
|
|
|
|
drupal_set_title($question, PASS_THROUGH);
|
|
|
|
$form['#attributes']['class'][] = 'confirmation';
|
|
$form['description'] = array('#markup' => $description);
|
|
$form[$name] = array('#type' => 'hidden', '#value' => 1);
|
|
|
|
$form['actions'] = array('#type' => 'actions');
|
|
$form['actions']['submit'] = array(
|
|
'#type' => 'submit',
|
|
'#value' => $yes ? $yes : t('Confirm'),
|
|
);
|
|
$form['actions']['cancel'] = array(
|
|
'#type' => 'link',
|
|
'#title' => $no ? $no : t('Cancel'),
|
|
'#href' => $options['path'],
|
|
'#options' => $options,
|
|
);
|
|
// By default, render the form using theme_confirm_form().
|
|
if (!isset($form['#theme'])) {
|
|
$form['#theme'] = 'confirm_form';
|
|
}
|
|
return $form;
|
|
}
|
|
|
|
/**
|
|
* Determines whether the current user is in compact mode.
|
|
*
|
|
* Compact mode shows certain administration pages with less description text,
|
|
* such as the configuration page and the permissions page.
|
|
*
|
|
* Whether the user is in compact mode is determined by a cookie, which is set
|
|
* for the user by \Drupal\system\Controller\SystemController::compactPage().
|
|
*
|
|
* If the user does not have the cookie, the default value is given by the
|
|
* system variable 'admin_compact_mode', which itself defaults to FALSE. This
|
|
* does not have a user interface to set it: it is a hidden variable which can
|
|
* be set in the settings.php file.
|
|
*
|
|
* @return bool
|
|
* TRUE when in compact mode, FALSE when in expanded mode.
|
|
*/
|
|
function system_admin_compact_mode() {
|
|
// PHP converts dots into underscores in cookie names to avoid problems with
|
|
// its parser, so we use a converted cookie name.
|
|
return isset($_COOKIE['Drupal_visitor_admin_compact_mode']) ? $_COOKIE['Drupal_visitor_admin_compact_mode'] : Drupal::config('system.site')->get('admin_compact_mode');
|
|
}
|
|
|
|
/**
|
|
* Generate a list of tasks offered by a specified module.
|
|
*
|
|
* @param $module
|
|
* Module name.
|
|
* @param $info
|
|
* The module's information, as provided by system_get_info().
|
|
*
|
|
* @return
|
|
* An array of task links.
|
|
*/
|
|
function system_get_module_admin_tasks($module, $info) {
|
|
$links = &drupal_static(__FUNCTION__);
|
|
|
|
if (!isset($links)) {
|
|
$links = array();
|
|
$menu_links = entity_get_controller('menu_link')->loadModuleAdminTasks();
|
|
foreach ($menu_links as $link) {
|
|
_menu_link_translate($link);
|
|
if ($link['access']) {
|
|
$links[$link['router_path']] = $link;
|
|
}
|
|
}
|
|
}
|
|
|
|
$admin_tasks = array();
|
|
$titles = array();
|
|
if ($menu = module_invoke($module, 'menu')) {
|
|
foreach ($menu as $path => $item) {
|
|
if (isset($links[$path])) {
|
|
$task = $links[$path];
|
|
// The link description, either derived from 'description' in
|
|
// hook_menu() or customized via menu module is used as title attribute.
|
|
if (!empty($task['localized_options']['attributes']['title'])) {
|
|
$task['description'] = $task['localized_options']['attributes']['title'];
|
|
unset($task['localized_options']['attributes']['title']);
|
|
}
|
|
|
|
// Check the admin tasks for duplicate names. If one is found,
|
|
// append the parent menu item's title to differentiate.
|
|
$duplicate_path = array_search($task['title'], $titles);
|
|
if ($duplicate_path !== FALSE) {
|
|
if ($parent = menu_link_load($task['plid'])) {
|
|
// Append the parent item's title to this task's title.
|
|
$task['title'] = t('@original_title (@parent_title)', array('@original_title' => $task['title'], '@parent_title' => $parent['title']));
|
|
}
|
|
if ($parent = menu_link_load($admin_tasks[$duplicate_path]['plid'])) {
|
|
// Append the parent item's title to the duplicated task's title.
|
|
// We use $links[$duplicate_path] in case there are triplicates.
|
|
$admin_tasks[$duplicate_path]['title'] = t('@original_title (@parent_title)', array('@original_title' => $links[$duplicate_path]['title'], '@parent_title' => $parent['title']));
|
|
}
|
|
}
|
|
else {
|
|
$titles[$path] = $task['title'];
|
|
}
|
|
|
|
$admin_tasks[$path] = $task;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Append link for permissions.
|
|
if (Drupal::moduleHandler()->implementsHook($module, 'permission')) {
|
|
$item = menu_get_item('admin/people/permissions');
|
|
if (!empty($item['access'])) {
|
|
$item['link_path'] = $item['href'];
|
|
$item['title'] = t('Configure @module permissions', array('@module' => $info['name']));
|
|
unset($item['description']);
|
|
$item['localized_options']['fragment'] = 'module-' . $module;
|
|
$item = entity_create('menu_link', $item);
|
|
$admin_tasks["admin/people/permissions#module-$module"] = $item;
|
|
}
|
|
}
|
|
|
|
return $admin_tasks;
|
|
}
|
|
|
|
/**
|
|
* Implements hook_cron().
|
|
*
|
|
* Remove older rows from flood and batch table. Remove old temporary files.
|
|
*/
|
|
function system_cron() {
|
|
// Cleanup the flood.
|
|
Drupal::service('flood')->garbageCollection();
|
|
|
|
Drupal::moduleHandler()->invokeAll('cache_flush');
|
|
foreach (Cache::getBins() as $cache_backend) {
|
|
$cache_backend->garbageCollection();
|
|
}
|
|
|
|
// Cleanup the queue for failed batches.
|
|
db_delete('queue')
|
|
->condition('created', REQUEST_TIME - 864000, '<')
|
|
->condition('name', 'drupal_batch:%', 'LIKE')
|
|
->execute();
|
|
|
|
// Reset expired items in the default queue implementation table. If that's
|
|
// not used, this will simply be a no-op.
|
|
db_update('queue')
|
|
->fields(array(
|
|
'expire' => 0,
|
|
))
|
|
->condition('expire', 0, '<>')
|
|
->condition('expire', REQUEST_TIME, '<')
|
|
->execute();
|
|
}
|
|
|
|
/**
|
|
* Implements hook_mail().
|
|
*/
|
|
function system_mail($key, &$message, $params) {
|
|
$token_service = Drupal::token();
|
|
|
|
$context = $params['context'];
|
|
|
|
$subject = $token_service->replace($context['subject'], $context);
|
|
$body = $token_service->replace($context['message'], $context);
|
|
|
|
$message['subject'] .= str_replace(array("\r", "\n"), '', $subject);
|
|
$message['body'][] = $body;
|
|
}
|
|
|
|
/**
|
|
* Generate an array of time zones and their local time&date.
|
|
*
|
|
* @param $blank
|
|
* If evaluates true, prepend an empty time zone option to the array.
|
|
*/
|
|
function system_time_zones($blank = NULL) {
|
|
$zonelist = timezone_identifiers_list();
|
|
$zones = $blank ? array('' => t('- None selected -')) : array();
|
|
foreach ($zonelist as $zone) {
|
|
// Because many time zones exist in PHP only for backward compatibility
|
|
// reasons and should not be used, the list is filtered by a regular
|
|
// expression.
|
|
if (preg_match('!^((Africa|America|Antarctica|Arctic|Asia|Atlantic|Australia|Europe|Indian|Pacific)/|UTC$)!', $zone)) {
|
|
$zones[$zone] = t('@zone', array('@zone' => t(str_replace('_', ' ', $zone))));
|
|
}
|
|
}
|
|
// Sort the translated time zones alphabetically.
|
|
asort($zones);
|
|
return $zones;
|
|
}
|
|
|
|
/**
|
|
* Returns HTML for the Powered by Drupal text.
|
|
*
|
|
* @ingroup themeable
|
|
*/
|
|
function theme_system_powered_by() {
|
|
return '<span>' . t('Powered by <a href="@poweredby">Drupal</a>', array('@poweredby' => 'http://drupal.org')) . '</span>';
|
|
}
|
|
|
|
/**
|
|
* Returns HTML for a link to show or hide inline help descriptions.
|
|
*
|
|
* @ingroup themeable
|
|
*/
|
|
function theme_system_compact_link() {
|
|
$output = '<div class="compact-link">';
|
|
if (system_admin_compact_mode()) {
|
|
$output .= l(t('Show descriptions'), 'admin/compact/off', array('attributes' => array('title' => t('Expand layout to include descriptions.')), 'query' => drupal_get_destination()));
|
|
}
|
|
else {
|
|
$output .= l(t('Hide descriptions'), 'admin/compact/on', array('attributes' => array('title' => t('Compress layout by hiding descriptions.')), 'query' => drupal_get_destination()));
|
|
}
|
|
$output .= '</div>';
|
|
|
|
return $output;
|
|
}
|
|
|
|
/**
|
|
* Attempts to get a file using Guzzle HTTP client and to store it locally.
|
|
*
|
|
* @param $url
|
|
* The URL of the file to grab.
|
|
*
|
|
* @param $destination
|
|
* Stream wrapper URI specifying where the file should be placed. If a
|
|
* directory path is provided, the file is saved into that directory under
|
|
* its original name. If the path contains a filename as well, that one will
|
|
* be used instead.
|
|
* If this value is omitted, the site's default files scheme will be used,
|
|
* usually "public://".
|
|
*
|
|
* @param $managed boolean
|
|
* If this is set to TRUE, the file API hooks will be invoked and the file is
|
|
* registered in the database.
|
|
*
|
|
* @param $replace boolean
|
|
* Replace behavior when the destination file already exists:
|
|
* - FILE_EXISTS_REPLACE: Replace the existing file.
|
|
* - FILE_EXISTS_RENAME: Append _{incrementing number} until the filename is
|
|
* unique.
|
|
* - FILE_EXISTS_ERROR: Do nothing and return FALSE.
|
|
*
|
|
* @return
|
|
* On success the location the file was saved to, FALSE on failure.
|
|
*/
|
|
function system_retrieve_file($url, $destination = NULL, $managed = FALSE, $replace = FILE_EXISTS_RENAME) {
|
|
$parsed_url = parse_url($url);
|
|
if (!isset($destination)) {
|
|
$path = file_build_uri(drupal_basename($parsed_url['path']));
|
|
}
|
|
else {
|
|
if (is_dir(drupal_realpath($destination))) {
|
|
// Prevent URIs with triple slashes when glueing parts together.
|
|
$path = str_replace('///', '//', "$destination/") . drupal_basename($parsed_url['path']);
|
|
}
|
|
else {
|
|
$path = $destination;
|
|
}
|
|
}
|
|
try {
|
|
$data = Drupal::httpClient()
|
|
->get($url)
|
|
->send()
|
|
->getBody(TRUE);
|
|
$local = $managed ? file_save_data($data, $path, $replace) : file_unmanaged_save_data($data, $path, $replace);
|
|
}
|
|
catch (BadResponseException $exception) {
|
|
$response = $exception->getResponse();
|
|
drupal_set_message(t('Failed to fetch file due to HTTP error "%error"', array('%error' => $response->getStatusCode() . ' ' . $response->getReasonPhrase())), 'error');
|
|
return FALSE;
|
|
}
|
|
catch (RequestException $exception) {
|
|
drupal_set_message(t('Failed to fetch file due to error "%error"', array('%error' => $exception->getMessage())), 'error');
|
|
return FALSE;
|
|
}
|
|
if (!$local) {
|
|
drupal_set_message(t('@remote could not be saved to @path.', array('@remote' => $url, '@path' => $path)), 'error');
|
|
}
|
|
|
|
return $local;
|
|
}
|
|
|
|
/**
|
|
* Implements hook_page_alter().
|
|
*/
|
|
function system_page_alter(&$page) {
|
|
// Find all non-empty page regions, and add a theme wrapper function that
|
|
// allows them to be consistently themed.
|
|
$regions = system_region_list($GLOBALS['theme']);
|
|
foreach (array_keys($regions) as $region) {
|
|
if (!empty($page[$region])) {
|
|
$page[$region]['#theme_wrappers'][] = 'region';
|
|
$page[$region]['#region'] = $region;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Run the automated cron if enabled.
|
|
*/
|
|
function system_run_automated_cron() {
|
|
// If the site is not fully installed, suppress the automated cron run.
|
|
// Otherwise it could be triggered prematurely by Ajax requests during
|
|
// installation.
|
|
if (($threshold = Drupal::config('system.cron')->get('threshold.autorun')) > 0 && variable_get('install_task') == 'done') {
|
|
$cron_last = Drupal::state()->get('system.cron_last') ?: NULL;
|
|
if (!isset($cron_last) || (REQUEST_TIME - $cron_last > $threshold)) {
|
|
drupal_cron_run();
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Returns HTML for a confirmation form.
|
|
*
|
|
* By default this does not alter the appearance of a form at all,
|
|
* but is provided as a convenience for themers.
|
|
*
|
|
* @param $variables
|
|
* An associative array containing:
|
|
* - form: A render element representing the form.
|
|
*
|
|
* @ingroup themeable
|
|
*/
|
|
function theme_confirm_form($variables) {
|
|
return drupal_render_children($variables['form']);
|
|
}
|
|
|
|
/**
|
|
* Returns HTML for a system settings form.
|
|
*
|
|
* By default this does not alter the appearance of a form at all,
|
|
* but is provided as a convenience for themers.
|
|
*
|
|
* @param $variables
|
|
* An associative array containing:
|
|
* - form: A render element representing the form.
|
|
*
|
|
* @ingroup themeable
|
|
*/
|
|
function theme_system_config_form($variables) {
|
|
return drupal_render_children($variables['form']);
|
|
}
|
|
|
|
/**
|
|
* Returns HTML for an exposed filter form.
|
|
*
|
|
* @param $variables
|
|
* An associative array containing:
|
|
* - form: An associative array containing the structure of the form.
|
|
*
|
|
* @return
|
|
* A string containing an HTML-formatted form.
|
|
*
|
|
* @ingroup themeable
|
|
*/
|
|
function theme_exposed_filters($variables) {
|
|
$form = $variables['form'];
|
|
$output = '';
|
|
|
|
if (isset($form['current'])) {
|
|
$items = array();
|
|
foreach (element_children($form['current']) as $key) {
|
|
$items[] = $form['current'][$key];
|
|
}
|
|
$output .= theme('item_list', array('items' => $items, 'attributes' => array('class' => array('clearfix', 'current-filters'))));
|
|
}
|
|
|
|
$output .= drupal_render_children($form);
|
|
|
|
return '<div class="exposed-filters">' . $output . '</div>';
|
|
}
|
|
|
|
/**
|
|
* Implements hook_admin_paths().
|
|
*/
|
|
function system_admin_paths() {
|
|
$paths = array(
|
|
'admin' => TRUE,
|
|
'admin/*' => TRUE,
|
|
'batch' => TRUE,
|
|
// This page should not be treated as administrative since it outputs its
|
|
// own content (outside of any administration theme).
|
|
'admin/reports/status/php' => FALSE,
|
|
);
|
|
return $paths;
|
|
}
|