diff --git a/core/lib/Drupal/Component/Utility/Xss.php b/core/lib/Drupal/Component/Utility/Xss.php
index 9081fae..7a06e124 100644
--- a/core/lib/Drupal/Component/Utility/Xss.php
+++ b/core/lib/Drupal/Component/Utility/Xss.php
@@ -192,7 +192,6 @@ protected static function attributes($attributes) {
$mode = 0;
$attribute_name = '';
$skip = FALSE;
- $skip_protocol_filtering = FALSE;
while (strlen($attributes) != 0) {
// Was the last operation successful?
@@ -204,20 +203,6 @@ protected static function attributes($attributes) {
if (preg_match('/^([-a-zA-Z]+)/', $attributes, $match)) {
$attribute_name = strtolower($match[1]);
$skip = ($attribute_name == 'style' || substr($attribute_name, 0, 2) == 'on');
-
- // Values for attributes of type URI should be filtered for
- // potentially malicious protocols (for example, an href-attribute
- // starting with "javascript:"). However, for some non-URI
- // attributes performing this filtering causes valid and safe data
- // to be mangled. We prevent this by skipping protocol filtering on
- // such attributes.
- // @see \Drupal\Component\Utility\UrlHelper::filterBadProtocol()
- // @see http://www.w3.org/TR/html4/index/attributes.html
- $skip_protocol_filtering = substr($attribute_name, 0, 5) === 'data-' || in_array($attribute_name, array(
- 'title',
- 'alt',
- ));
-
$working = $mode = 1;
$attributes = preg_replace('/^[-a-zA-Z]+/', '', $attributes);
}
@@ -243,7 +228,7 @@ protected static function attributes($attributes) {
case 2:
// Attribute value, a URL after href= for instance.
if (preg_match('/^"([^"]*)"(\s+|$)/', $attributes, $match)) {
- $thisval = $skip_protocol_filtering ? $match[1] : UrlHelper::filterBadProtocol($match[1]);
+ $thisval = UrlHelper::filterBadProtocol($match[1]);
if (!$skip) {
$attributes_array[] = "$attribute_name=\"$thisval\"";
@@ -255,7 +240,7 @@ protected static function attributes($attributes) {
}
if (preg_match("/^'([^']*)'(\s+|$)/", $attributes, $match)) {
- $thisval = $skip_protocol_filtering ? $match[1] : UrlHelper::filterBadProtocol($match[1]);
+ $thisval = UrlHelper::filterBadProtocol($match[1]);
if (!$skip) {
$attributes_array[] = "$attribute_name='$thisval'";
@@ -266,7 +251,7 @@ protected static function attributes($attributes) {
}
if (preg_match("%^([^\s\"']+)(\s+|$)%", $attributes, $match)) {
- $thisval = $skip_protocol_filtering ? $match[1] : UrlHelper::filterBadProtocol($match[1]);
+ $thisval = UrlHelper::filterBadProtocol($match[1]);
if (!$skip) {
$attributes_array[] = "$attribute_name=\"$thisval\"";
diff --git a/core/lib/Drupal/Core/Mail/MailManagerInterface.php b/core/lib/Drupal/Core/Mail/MailManagerInterface.php
index ded236b..5cb446a 100644
--- a/core/lib/Drupal/Core/Mail/MailManagerInterface.php
+++ b/core/lib/Drupal/Core/Mail/MailManagerInterface.php
@@ -116,7 +116,7 @@
* hook_mail_alter() may cancel sending by setting $message['send'] to
* FALSE.
*
- * @return array
+ * @return string
* The $message array structure containing all details of the message. If
* already sent ($send = TRUE), then the 'result' element will contain the
* success indicator of the email, failure being already written to the
diff --git a/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php b/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php
index d12522a..8821930 100644
--- a/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php
+++ b/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php
@@ -157,10 +157,12 @@ public function renderResponse(array $main_content, Request $request, RouteMatch
// entire render cache, regardless of the cache bin.
$cache_contexts = [];
$cache_tags = ['rendered'];
+ $cache_max_age = Cache::PERMANENT;
foreach (['page_top', 'page', 'page_bottom'] as $region) {
if (isset($html[$region])) {
$cache_contexts = Cache::mergeContexts($cache_contexts, $html[$region]['#cache']['contexts']);
$cache_tags = Cache::mergeTags($cache_tags, $html[$region]['#cache']['tags']);
+ $cache_max_age = Cache::mergeMaxAges($cache_max_age, $html[$region]['#cache']['max-age']);
}
}
@@ -172,6 +174,11 @@ public function renderResponse(array $main_content, Request $request, RouteMatch
'X-Drupal-Cache-Contexts' => implode(' ', $this->cacheContexts->optimizeTokens($cache_contexts)),
'X-Generator' => 'Drupal ' . $version . ' (https://www.drupal.org)'
]);
+ // If an explicit non-infinite max-age is specified by a part of the page,
+ // respect that by applying it to the response's headers.
+ if ($cache_max_age !== Cache::PERMANENT) {
+ $response->setMaxAge($cache_max_age);
+ }
return $response;
}
diff --git a/core/lib/Drupal/Core/Session/SessionManager.php b/core/lib/Drupal/Core/Session/SessionManager.php
index 3c71930..52b3542 100644
--- a/core/lib/Drupal/Core/Session/SessionManager.php
+++ b/core/lib/Drupal/Core/Session/SessionManager.php
@@ -174,7 +174,6 @@ protected function startNow() {
// Restore session data.
if ($this->startedLazy) {
$_SESSION = $session_data;
- $this->loadSession();
}
return $result;
diff --git a/core/lib/Drupal/Core/Template/TwigExtension.php b/core/lib/Drupal/Core/Template/TwigExtension.php
index 44b0a2a..a2b1f59 100644
--- a/core/lib/Drupal/Core/Template/TwigExtension.php
+++ b/core/lib/Drupal/Core/Template/TwigExtension.php
@@ -215,8 +215,6 @@ public function getUrl($name, $parameters = array(), $options = array()) {
*
* @return string
* The generated absolute URL for the given path.
- *
- * @deprecated in Drupal 8.0.x-dev and will be removed before Drupal 8.0.0.
*/
public function getUrlFromPath($path, $options = array()) {
$options['absolute'] = TRUE;
diff --git a/core/misc/tabledrag.js b/core/misc/tabledrag.js
index 1cc7515..d0c6241 100644
--- a/core/misc/tabledrag.js
+++ b/core/misc/tabledrag.js
@@ -158,7 +158,7 @@
if (this.tableSettings.hasOwnProperty(group)) { // Find the first field in this group.
for (var d in this.tableSettings[group]) {
if (this.tableSettings[group].hasOwnProperty(d)) {
- var field = $table.find('.' + this.tableSettings[group][d].target).eq(0);
+ var field = $table.find('.' + this.tableSettings[group][d].target + ':first');
if (field.length && this.tableSettings[group][d].hidden) {
hidden = this.tableSettings[group][d].hidden;
cell = field.closest('td');
@@ -311,18 +311,18 @@
var self = this;
var $item = $(item);
// Add a class to the title link
- $item.find('td').eq(0).find('a').addClass('menu-item__link');
+ $item.find('td:first a').addClass('menu-item__link');
// Create the handle.
var handle = $('
' . t('The RDF module enriches your content with metadata to let other applications (e.g., search engines, aggregators, and so on) better understand its relationships and attributes. This semantically enriched, machine-readable output for your website uses the RDFa specification, which allows RDF data to be embedded in HTML markup. Other modules can define mappings of their data to RDF terms, and the RDF module makes this RDF data available to the theme. The core modules define RDF mappings for their data model, and the core themes output this RDF metadata information along with the human-readable visual information. For more information, see the online documentation for the RDF module.', array('!rdfa' => 'http://www.w3.org/TR/xhtml-rdfa-primer/', '!rdf' => 'https://drupal.org/documentation/modules/rdf')) . '
'; + $output .= '' . t('The RDF module enriches your content with metadata to let other applications (e.g., search engines, aggregators, and so on) better understand its relationships and attributes. This semantically enriched, machine-readable output for Drupal sites uses the RDFa specification, which allows RDF data to be embedded in HTML markup. Other modules can define mappings of their data to RDF terms, and the RDF module makes this RDF data available to the theme. The core Drupal modules define RDF mappings for their data model, and the core Drupal themes output this RDF metadata information along with the human-readable visual information. For more information, see the online documentation for the RDF module.', array('!rdfa' => 'http://www.w3.org/TR/xhtml-rdfa-primer/', '!rdf' => 'https://drupal.org/documentation/modules/rdf')) . '
'; return $output; } } diff --git a/core/modules/rdf/src/Tests/ImageFieldAttributesTest.php b/core/modules/rdf/src/Tests/ImageFieldAttributesTest.php index 4ae8f0b..c58b3bb 100644 --- a/core/modules/rdf/src/Tests/ImageFieldAttributesTest.php +++ b/core/modules/rdf/src/Tests/ImageFieldAttributesTest.php @@ -7,7 +7,6 @@ namespace Drupal\rdf\Tests; -use Drupal\image\Entity\ImageStyle; use Drupal\image\Tests\ImageFieldTestBase; use Drupal\node\Entity\Node; @@ -97,7 +96,7 @@ function testNodeTeaser() { // Construct the node and image URIs for testing. $node_uri = $this->node->url('canonical', ['absolute' => TRUE]); - $image_uri = ImageStyle::load('medium')->buildUrl($this->file->getFileUri()); + $image_uri = entity_load('image_style', 'medium')->buildUrl($this->file->getFileUri()); // Test relations from node to image. $expected_value = array( diff --git a/core/modules/rdf/src/Tests/StandardProfileTest.php b/core/modules/rdf/src/Tests/StandardProfileTest.php index d9a31f0..78c08fc 100644 --- a/core/modules/rdf/src/Tests/StandardProfileTest.php +++ b/core/modules/rdf/src/Tests/StandardProfileTest.php @@ -8,10 +8,9 @@ namespace Drupal\rdf\Tests; use Drupal\Core\Url; -use Drupal\image\Entity\ImageStyle; -use Drupal\node\Entity\NodeType; use Drupal\node\NodeInterface; use Drupal\simpletest\WebTestBase; +use Drupal\node\Entity\NodeType; /** * Tests the RDF mappings and RDFa markup of the standard profile. @@ -166,7 +165,7 @@ protected function setUp() { // Set URIs. // Image. $image_file = $this->article->get('field_image')->entity; - $this->imageUri = ImageStyle::load('large')->buildUrl($image_file->getFileUri()); + $this->imageUri = entity_load('image_style', 'large')->buildUrl($image_file->getFileUri()); // Term. $this->termUri = $this->term->url('canonical', array('absolute' => TRUE)); // Article. @@ -225,7 +224,7 @@ protected function doFrontPageRdfaTests() { // @todo Once the image points to the original instead of the processed // image, move this to testArticleProperties(). $image_file = $this->article->get('field_image')->entity; - $image_uri = ImageStyle::load('medium')->buildUrl($image_file->getFileUri()); + $image_uri = entity_load('image_style', 'medium')->buildUrl($image_file->getFileUri()); $expected_value = array( 'type' => 'uri', 'value' => $image_uri, diff --git a/core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php b/core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php index b3500fe..bc8cb93 100644 --- a/core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php +++ b/core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php @@ -16,6 +16,7 @@ use Drupal\Core\Url; use Drupal\image\Plugin\Field\FieldFormatter\ImageFormatterBase; use Symfony\Component\DependencyInjection\ContainerInterface; +use Drupal\image\Entity\ImageStyle; /** * Plugin for responsive image formatter. @@ -35,13 +36,6 @@ class ResponsiveImageFormatter extends ImageFormatterBase implements ContainerFa */ protected $responsiveImageStyleStorage; - /* - * The image style entity storage. - * - * @var \Drupal\Core\Entity\EntityStorageInterface - */ - protected $imageStyleStorage; - /** * Constructs a ResponsiveImageFormatter object. * @@ -61,14 +55,11 @@ class ResponsiveImageFormatter extends ImageFormatterBase implements ContainerFa * Any third party settings. * @param \Drupal\Core\Entity\EntityStorageInterface $responsive_image_style_storage * The responsive image style storage. - * @param \Drupal\Core\Entity\EntityStorageInterface $image_style_storage - * The image style storage. */ - public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, EntityStorageInterface $responsive_image_style_storage, EntityStorageInterface $image_style_storage) { + public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, EntityStorageInterface $responsive_image_style_storage) { parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings); $this->responsiveImageStyleStorage = $responsive_image_style_storage; - $this->imageStyleStorage = $image_style_storage; } /** @@ -83,8 +74,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration['label'], $configuration['view_mode'], $configuration['third_party_settings'], - $container->get('entity.manager')->getStorage('responsive_image_style'), - $container->get('entity.manager')->getStorage('image_style') + $container->get('entity.manager')->getStorage('responsive_image_style') ); } @@ -232,7 +222,7 @@ public function viewElements(FieldItemListInterface $items) { // selected for the smallest screen. $fallback_image_style = end($image_styles_to_load); } - $image_styles = $this->imageStyleStorage->loadMultiple($image_styles_to_load); + $image_styles = ImageStyle::loadMultiple($image_styles_to_load); foreach ($image_styles as $image_style) { $cache_tags = Cache::mergeTags($cache_tags, $image_style->getCacheTags()); } diff --git a/core/modules/simpletest/src/BrowserTestBase.php b/core/modules/simpletest/src/BrowserTestBase.php index 6cba2e0..e531b65 100644 --- a/core/modules/simpletest/src/BrowserTestBase.php +++ b/core/modules/simpletest/src/BrowserTestBase.php @@ -29,26 +29,14 @@ use Symfony\Component\HttpFoundation\Request; /** - * Provides a test case for functional Drupal tests. + * Test case for functional Drupal tests. * - * Note that this class does not yet have feature parity with WebTestBase, so - * WebTestBase should be used where possible. In particular, this class does - * not yet have the following features: - * - verbose output - see https://www.drupal.org/node/2469721 - * - ajax form emulation - see https://www.drupal.org/node/2469713 - * - * Tests extending BrowserTestBase must exist in the - * Drupal\Tests\yourmodule\Functional namespace and live in the - * modules/yourmodule/Tests/Functional directory. + * @ingroup testing * * All BrowserTestBase tests must have two annotations to ensure process * isolation: * - @runTestsInSeparateProcesses * - @preserveGlobalState disabled - * - * @ingroup testing - * - * @see \Drupal\simpletest\WebTestBase */ abstract class BrowserTestBase extends \PHPUnit_Framework_TestCase { diff --git a/core/modules/simpletest/src/TestBase.php b/core/modules/simpletest/src/TestBase.php index 9a38774..a95bade 100644 --- a/core/modules/simpletest/src/TestBase.php +++ b/core/modules/simpletest/src/TestBase.php @@ -1652,24 +1652,4 @@ protected function config($name) { return \Drupal::configFactory()->getEditable($name); } - /** - * Gets the database prefix. - * - * @return string - * The database prefix - */ - public function getDatabasePrefix() { - return $this->databasePrefix; - } - - /** - * Gets the temporary files directory. - * - * @return string - * The temporary files directory. - */ - public function getTempFilesDirectory() { - return $this->tempFilesDirectory; - } - } diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php index 8e29d46..1ae8e58 100644 --- a/core/modules/simpletest/src/WebTestBase.php +++ b/core/modules/simpletest/src/WebTestBase.php @@ -1542,7 +1542,7 @@ protected function drupalGetJSON($path, array $options = array(), array $headers /** * Requests a Drupal path in drupal_ajax format and JSON-decodes the response. */ - protected function drupalGetAjax($path, array $options = array(), array $headers = array()) { + protected function drupalGetAJAX($path, array $options = array(), array $headers = array()) { $headers[] = 'Accept: application/vnd.drupal-ajax'; return Json::decode($this->drupalGet($path, $options, $headers)); } diff --git a/core/modules/system/core.api.php b/core/modules/system/core.api.php index 14c894a..778cdb3 100644 --- a/core/modules/system/core.api.php +++ b/core/modules/system/core.api.php @@ -1866,112 +1866,6 @@ function hook_display_variant_plugin_alter(array &$definitions) { } /** - * Flush all persistent and static caches. - * - * This hook asks your module to clear all of its static caches, - * in order to ensure a clean environment for subsequently - * invoked data rebuilds. - * - * Do NOT use this hook for rebuilding information. Only use it to flush custom - * caches. - * - * Static caches using drupal_static() do not need to be reset manually. - * However, all other static variables that do not use drupal_static() must be - * manually reset. - * - * This hook is invoked by drupal_flush_all_caches(). It runs before module data - * is updated and before hook_rebuild(). - * - * @see drupal_flush_all_caches() - * @see hook_rebuild() - */ -function hook_cache_flush() { - if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'update') { - _update_cache_clear(); - } -} - -/** - * Rebuild data based upon refreshed caches. - * - * This hook allows your module to rebuild its data based on the latest/current - * module data. It runs after hook_cache_flush() and after all module data has - * been updated. - * - * This hook is only invoked after the system has been completely cleared; - * i.e., all previously cached data is known to be gone and every API in the - * system is known to return current information, so your module can safely rely - * on all available data to rebuild its own. - * - * @see hook_cache_flush() - * @see drupal_flush_all_caches() - */ -function hook_rebuild() { - $themes = \Drupal::service('theme_handler')->listInfo(); - foreach ($themes as $theme) { - _block_rehash($theme->getName()); - } -} - -/** - * Alter the configuration synchronization steps. - * - * @param array $sync_steps - * A one-dimensional array of \Drupal\Core\Config\ConfigImporter method names - * or callables that are invoked to complete the import, in the order that - * they will be processed. Each callable item defined in $sync_steps should - * either be a global function or a public static method. The callable should - * accept a $context array by reference. For example: - *
- * function _additional_configuration_step(&$context) {
- * // Do stuff.
- * // If finished set $context['finished'] = 1.
- * }
- *
- * For more information on creating batches, see the
- * @link batch Batch operations @endlink documentation.
- *
- * @see callback_batch_operation()
- * @see \Drupal\Core\Config\ConfigImporter::initialize()
- */
-function hook_config_import_steps_alter(&$sync_steps, \Drupal\Core\Config\ConfigImporter $config_importer) {
- $deletes = $config_importer->getUnprocessedConfiguration('delete');
- if (isset($deletes['field.storage.node.body'])) {
- $sync_steps[] = '_additional_configuration_step';
- }
-}
-
-/**
- * Alter config typed data definitions.
- *
- * For example you can alter the typed data types representing each
- * configuration schema type to change default labels or form element renderers
- * used for configuration translation.
- *
- * If implementations of this hook add or remove configuration schema a
- * ConfigSchemaAlterException will be thrown. Keep in mind that there are tools
- * that may use the configuration schema for static analysis of configuration
- * files, like the string extractor for the localization system. Such systems
- * won't work with dynamically defined configuration schemas.
- *
- * For adding new data types use configuration schema YAML files instead.
- *
- * @param $definitions
- * Associative array of configuration type definitions keyed by schema type
- * names. The elements are themselves array with information about the type.
- *
- * @see \Drupal\Core\Config\TypedConfigManager
- * @see \Drupal\Core\Config\Schema\ConfigSchemaAlterException
- */
-function hook_config_schema_info_alter(&$definitions) {
- // Enhance the text and date type definitions with classes to generate proper
- // form elements in ConfigTranslationFormBase. Other translatable types will
- // appear as a one line textfield.
- $definitions['text']['form_element_class'] = '\Drupal\config_translation\FormElement\Textarea';
- $definitions['date_format']['form_element_class'] = '\Drupal\config_translation\FormElement\DateFormat';
-}
-
-/**
* @} End of "addtogroup hooks".
*/
diff --git a/core/modules/system/entity.api.php b/core/modules/system/entity.api.php
index d188375..e69a92a 100644
--- a/core/modules/system/entity.api.php
+++ b/core/modules/system/entity.api.php
@@ -2,7 +2,7 @@
/**
* @file
- * Hooks and documentation related to entities.
+ * Hooks provided the Entity module.
*/
use Drupal\Core\Entity\FieldableEntityInterface;
diff --git a/core/modules/system/menu.api.php b/core/modules/system/menu.api.php
index 95be071..f30f708 100644
--- a/core/modules/system/menu.api.php
+++ b/core/modules/system/menu.api.php
@@ -2,7 +2,7 @@
/**
* @file
- * Hooks and documentation related to the menu system, routing, and links.
+ * Hooks related to the Menu system.
*/
/**
@@ -555,49 +555,5 @@ function hook_system_breadcrumb_alter(array &$breadcrumb, \Drupal\Core\Routing\R
}
/**
- * Alter the parameters for links.
- *
- * @param array $variables
- * An associative array of variables defining a link. The link may be either a
- * "route link" using \Drupal\Core\Utility\LinkGenerator::link(), which is
- * exposed as the 'link_generator' service or a link generated by _l(). If the
- * link is a "route link", 'route_name' will be set, otherwise 'path' will be
- * set. The following keys can be altered:
- * - text: The link text for the anchor tag as a translated string.
- * - url_is_active: Whether or not the link points to the currently active
- * URL.
- * - url: The \Drupal\Core\Url object.
- * - options: An associative array of additional options that will be passed
- * to either \Drupal\Core\Routing\UrlGenerator::generateFromPath() or
- * \Drupal\Core\Routing\UrlGenerator::generateFromRoute() to generate the
- * href attribute for this link, and also used when generating the link.
- * Defaults to an empty array. It may contain the following elements:
- * - 'query': An array of query key/value-pairs (without any URL-encoding) to
- * append to the URL.
- * - absolute: Whether to force the output to be an absolute link (beginning
- * with http:). Useful for links that will be displayed outside the site,
- * such as in an RSS feed. Defaults to FALSE.
- * - language: An optional language object. May affect the rendering of
- * the anchor tag, such as by adding a language prefix to the path.
- * - attributes: An associative array of HTML attributes to apply to the
- * anchor tag. If element 'class' is included, it must be an array; 'title'
- * must be a string; other elements are more flexible, as they just need
- * to work as an argument for the constructor of the class
- * Drupal\Core\Template\Attribute($options['attributes']).
- * - html: Whether or not HTML should be allowed as the link text. If FALSE,
- * the text will be run through
- * \Drupal\Component\Utility\SafeMarkup::checkPlain() before being output.
- *
- * @see \Drupal\Core\Routing\UrlGenerator::generateFromPath()
- * @see \Drupal\Core\Routing\UrlGenerator::generateFromRoute()
- */
-function hook_link_alter(&$variables) {
- // Add a warning to the end of route links to the admin section.
- if (isset($variables['route_name']) && strpos($variables['route_name'], 'admin') !== FALSE) {
- $variables['text'] .= ' (Warning!)';
- }
-}
-
-/**
* @} End of "addtogroup hooks".
*/
diff --git a/core/modules/system/module.api.php b/core/modules/system/module.api.php
index 9d5005e..52b77af 100644
--- a/core/modules/system/module.api.php
+++ b/core/modules/system/module.api.php
@@ -1,8 +1,7 @@
'submit',
'#value' => $this->t('Save configuration'),
- '#button_type' => 'primary',
);
return $form;
diff --git a/core/modules/system/src/Form/ThemeAdminForm.php b/core/modules/system/src/Form/ThemeAdminForm.php
index 27f8098..9aa7123 100644
--- a/core/modules/system/src/Form/ThemeAdminForm.php
+++ b/core/modules/system/src/Form/ThemeAdminForm.php
@@ -49,7 +49,6 @@ public function buildForm(array $form, FormStateInterface $form_state, array $th
$form['admin_theme']['actions']['submit'] = array(
'#type' => 'submit',
'#value' => $this->t('Save configuration'),
- '#button_type' => 'primary',
);
return $form;
}
diff --git a/core/modules/system/src/Tests/Ajax/DialogTest.php b/core/modules/system/src/Tests/Ajax/DialogTest.php
index 482e025..37bf06c 100644
--- a/core/modules/system/src/Tests/Ajax/DialogTest.php
+++ b/core/modules/system/src/Tests/Ajax/DialogTest.php
@@ -93,7 +93,7 @@ public function testDialog() {
$this->assertRaw($dialog_contents, 'Non-JS modal dialog page present.');
// Emulate going to the JS version of the page and check the JSON response.
- $ajax_result = $this->drupalGetAjax('ajax-test/dialog-contents', array(), array('Accept: application/vnd.drupal-modal'));
+ $ajax_result = $this->drupalGetAJAX('ajax-test/dialog-contents', array(), array('Accept: application/vnd.drupal-modal'));
$this->assertEqual($modal_expected_response, $ajax_result[3], 'Modal dialog JSON response matches.');
// Check that requesting a "normal" dialog without JS goes to a page.
@@ -127,7 +127,7 @@ public function testDialog() {
// Emulate closing the dialog via an AJAX request. There is no non-JS
// version of this test.
- $ajax_result = $this->drupalGetAjax('ajax-test/dialog-close');
+ $ajax_result = $this->drupalGetAJAX('ajax-test/dialog-close');
$this->assertEqual($close_expected_response, $ajax_result[0], 'Close dialog JSON response matches.');
// Test submitting via a POST request through the button for modals. This
@@ -159,7 +159,7 @@ public function testDialog() {
$this->assertTrue(!empty($form), 'Non-JS form page present.');
// Emulate going to the JS version of the form and check the JSON response.
- $ajax_result = $this->drupalGetAjax('ajax-test/dialog-form', array(), array('Accept: application/vnd.drupal-modal'));
+ $ajax_result = $this->drupalGetAJAX('ajax-test/dialog-form', array(), array('Accept: application/vnd.drupal-modal'));
$expected_ajax_settings = [
'edit-preview' => [
'callback' => '::preview',
@@ -188,7 +188,7 @@ public function testDialog() {
$this->assertTrue(!empty($form), 'Non-JS entity form page present.');
// Emulate going to the JS version of the form and check the JSON response.
- $ajax_result = $this->drupalGetAjax('admin/structure/contact/add', array(), array('Accept: application/vnd.drupal-modal'));
+ $ajax_result = $this->drupalGetAJAX('admin/structure/contact/add', array(), array('Accept: application/vnd.drupal-modal'));
$this->setRawContent($ajax_result[3]['data']);
// Remove the data, the form build id and token will never match.
unset($ajax_result[3]['data']);
diff --git a/core/modules/system/src/Tests/Ajax/FrameworkTest.php b/core/modules/system/src/Tests/Ajax/FrameworkTest.php
index 52787c9..85e9d8f 100644
--- a/core/modules/system/src/Tests/Ajax/FrameworkTest.php
+++ b/core/modules/system/src/Tests/Ajax/FrameworkTest.php
@@ -26,7 +26,7 @@ class FrameworkTest extends AjaxTestBase {
*/
public function testAJAXRender() {
// Verify that settings command is generated if JavaScript settings exist.
- $commands = $this->drupalGetAjax('ajax-test/render');
+ $commands = $this->drupalGetAJAX('ajax-test/render');
$expected = new SettingsCommand(array('ajax' => 'test'), TRUE);
$this->assertCommand($commands, $expected->render(), '\Drupal\Core\Ajax\AjaxResponse::ajaxRender() loads JavaScript settings.');
}
@@ -86,7 +86,7 @@ public function testAJAXRenderError() {
$edit = array(
'message' => 'Custom error message.',
);
- $commands = $this->drupalGetAjax('ajax-test/render-error', array('query' => $edit));
+ $commands = $this->drupalGetAJAX('ajax-test/render-error', array('query' => $edit));
$expected = new AlertCommand($edit['message']);
$this->assertCommand($commands, $expected->render(), 'Custom error message is output.');
}
diff --git a/core/modules/system/src/Tests/Bootstrap/PageCacheTest.php b/core/modules/system/src/Tests/Bootstrap/PageCacheTest.php
index 4256c16..610c9b1 100644
--- a/core/modules/system/src/Tests/Bootstrap/PageCacheTest.php
+++ b/core/modules/system/src/Tests/Bootstrap/PageCacheTest.php
@@ -236,12 +236,6 @@ function testPageCache() {
$this->assertEqual($this->drupalGetHeader('Cache-Control'), 'must-revalidate, no-cache, post-check=0, pre-check=0, private', 'Cache-Control header was sent.');
$this->assertEqual($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', 'Expires header was sent.');
$this->assertEqual($this->drupalGetHeader('Foo'), 'bar', 'Custom header was sent.');
-
- // Until bubbling of max-age up to the response is supported, verify that
- // a custom #cache max-age set on an element does not affect page max-age.
- $this->drupalLogout();
- $this->drupalGet('system-test/cache_maxage_page');
- $this->assertEqual($this->drupalGetHeader('Cache-Control'), 'max-age=300, public');
}
/**
diff --git a/core/modules/system/src/Tests/Entity/ConfigEntityImportTest.php b/core/modules/system/src/Tests/Entity/ConfigEntityImportTest.php
index 57a97c2..f7036d3 100644
--- a/core/modules/system/src/Tests/Entity/ConfigEntityImportTest.php
+++ b/core/modules/system/src/Tests/Entity/ConfigEntityImportTest.php
@@ -8,7 +8,6 @@
namespace Drupal\system\Tests\Entity;
use Drupal\Core\Entity\EntityWithPluginCollectionInterface;
-use Drupal\image\Entity\ImageStyle;
use Drupal\simpletest\WebTestBase;
/**
@@ -124,7 +123,7 @@ protected function doImageStyleUpdate() {
$name = 'image.style.thumbnail';
/** @var $entity \Drupal\image\Entity\ImageStyle */
- $entity = ImageStyle::load('thumbnail');
+ $entity = entity_load('image_style', 'thumbnail');
$plugin_collection = $entity->getPluginCollections()['effects'];
$effects = $entity->get('effects');
diff --git a/core/modules/system/src/Tests/Form/StorageTest.php b/core/modules/system/src/Tests/Form/StorageTest.php
index 64a9983..f77c567 100644
--- a/core/modules/system/src/Tests/Form/StorageTest.php
+++ b/core/modules/system/src/Tests/Form/StorageTest.php
@@ -219,7 +219,7 @@ public function testImmutableFormLegacyProtection() {
$build_id = (string) $build_id_fields[0]['value'];
// Try to poison the form cache.
- $original = $this->drupalGetAjax('form-test/form-storage-legacy/' . $build_id);
+ $original = $this->drupalGetAJAX('form-test/form-storage-legacy/' . $build_id);
$this->assertEqual($original['form']['#build_id_old'], $build_id, 'Original build_id was recorded');
$this->assertNotEqual($original['form']['#build_id'], $build_id, 'New build_id was generated');
@@ -229,7 +229,7 @@ public function testImmutableFormLegacyProtection() {
$this->assert($status, 'A watchdog message was logged by \Drupal::formBuilder()->setCache');
// Ensure that the form state was not poisoned by the preceding call.
- $original = $this->drupalGetAjax('form-test/form-storage-legacy/' . $build_id);
+ $original = $this->drupalGetAJAX('form-test/form-storage-legacy/' . $build_id);
$this->assertEqual($original['form']['#build_id_old'], $build_id, 'Original build_id was recorded');
$this->assertNotEqual($original['form']['#build_id'], $build_id, 'New build_id was generated');
$this->assert(empty($original['form']['#poisoned']), 'Original form structure was preserved');
diff --git a/core/modules/system/src/Tests/Routing/RouterTest.php b/core/modules/system/src/Tests/Routing/RouterTest.php
index e0a4f34..b03b194 100644
--- a/core/modules/system/src/Tests/Routing/RouterTest.php
+++ b/core/modules/system/src/Tests/Routing/RouterTest.php
@@ -212,7 +212,7 @@ public function testUserAccount() {
public function testControllerResolutionAjax() {
// This will fail with a JSON parse error if the request is not routed to
// The correct controller.
- $this->drupalGetAjax('/router_test/test10');
+ $this->drupalGetAJAX('/router_test/test10');
$this->assertEqual($this->drupalGetHeader('Content-Type'), 'application/json', 'Correct mime content type was returned');
diff --git a/core/modules/system/src/Tests/Session/SessionTest.php b/core/modules/system/src/Tests/Session/SessionTest.php
index 4e67192..75b194a 100644
--- a/core/modules/system/src/Tests/Session/SessionTest.php
+++ b/core/modules/system/src/Tests/Session/SessionTest.php
@@ -138,18 +138,6 @@ function testDataPersistence() {
}
/**
- * Tests storing data in Session() object.
- */
- public function testSessionPersistenceOnLogin() {
- // Store information via hook_user_login().
- $user = $this->drupalCreateUser();
- $this->drupalLogin($user);
- // Test property added to session object form hook_user_login().
- $this->drupalGet('session-test/get-from-session-object');
- $this->assertText('foobar', 'Session data is saved in Session() object.', 'Session');
- }
-
- /**
* Test that empty anonymous sessions are destroyed.
*/
function testEmptyAnonymousSession() {
diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php
index bd391ed..34fb4a8 100644
--- a/core/modules/system/system.api.php
+++ b/core/modules/system/system.api.php
@@ -2,7 +2,7 @@
/**
* @file
- * Hooks provided by the System module.
+ * Hooks provided by Drupal core and the System module.
*/
use Drupal\Component\Utility\SafeMarkup;
@@ -16,6 +16,54 @@
*/
/**
+ * Flush all persistent and static caches.
+ *
+ * This hook asks your module to clear all of its static caches,
+ * in order to ensure a clean environment for subsequently
+ * invoked data rebuilds.
+ *
+ * Do NOT use this hook for rebuilding information. Only use it to flush custom
+ * caches.
+ *
+ * Static caches using drupal_static() do not need to be reset manually.
+ * However, all other static variables that do not use drupal_static() must be
+ * manually reset.
+ *
+ * This hook is invoked by drupal_flush_all_caches(). It runs before module data
+ * is updated and before hook_rebuild().
+ *
+ * @see drupal_flush_all_caches()
+ * @see hook_rebuild()
+ */
+function hook_cache_flush() {
+ if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'update') {
+ _update_cache_clear();
+ }
+}
+
+/**
+ * Rebuild data based upon refreshed caches.
+ *
+ * This hook allows your module to rebuild its data based on the latest/current
+ * module data. It runs after hook_cache_flush() and after all module data has
+ * been updated.
+ *
+ * This hook is only invoked after the system has been completely cleared;
+ * i.e., all previously cached data is known to be gone and every API in the
+ * system is known to return current information, so your module can safely rely
+ * on all available data to rebuild its own.
+ *
+ * @see hook_cache_flush()
+ * @see drupal_flush_all_caches()
+ */
+function hook_rebuild() {
+ $themes = \Drupal::service('theme_handler')->listInfo();
+ foreach ($themes as $theme) {
+ _block_rehash($theme->getName());
+ }
+}
+
+/**
* Alters theme operation links.
*
* @param $theme_groups
@@ -280,5 +328,107 @@ function hook_token_info_alter(&$data) {
}
/**
+ * Alter the parameters for links.
+ *
+ * @param array $variables
+ * An associative array of variables defining a link. The link may be either a
+ * "route link" using \Drupal\Core\Utility\LinkGenerator::link(), which is
+ * exposed as the 'link_generator' service or a link generated by _l(). If the
+ * link is a "route link", 'route_name' will be set, otherwise 'path' will be
+ * set. The following keys can be altered:
+ * - text: The link text for the anchor tag as a translated string.
+ * - url_is_active: Whether or not the link points to the currently active
+ * URL.
+ * - url: The \Drupal\Core\Url object.
+ * - options: An associative array of additional options that will be passed
+ * to either \Drupal\Core\Routing\UrlGenerator::generateFromPath() or
+ * \Drupal\Core\Routing\UrlGenerator::generateFromRoute() to generate the
+ * href attribute for this link, and also used when generating the link.
+ * Defaults to an empty array. It may contain the following elements:
+ * - 'query': An array of query key/value-pairs (without any URL-encoding) to
+ * append to the URL.
+ * - absolute: Whether to force the output to be an absolute link (beginning
+ * with http:). Useful for links that will be displayed outside the site,
+ * such as in an RSS feed. Defaults to FALSE.
+ * - language: An optional language object. May affect the rendering of
+ * the anchor tag, such as by adding a language prefix to the path.
+ * - attributes: An associative array of HTML attributes to apply to the
+ * anchor tag. If element 'class' is included, it must be an array; 'title'
+ * must be a string; other elements are more flexible, as they just need
+ * to work as an argument for the constructor of the class
+ * Drupal\Core\Template\Attribute($options['attributes']).
+ * - html: Whether or not HTML should be allowed as the link text. If FALSE,
+ * the text will be run through
+ * \Drupal\Component\Utility\SafeMarkup::checkPlain() before being output.
+ *
+ * @see \Drupal\Core\Routing\UrlGenerator::generateFromPath()
+ * @see \Drupal\Core\Routing\UrlGenerator::generateFromRoute()
+ */
+function hook_link_alter(&$variables) {
+ // Add a warning to the end of route links to the admin section.
+ if (isset($variables['route_name']) && strpos($variables['route_name'], 'admin') !== FALSE) {
+ $variables['text'] .= ' (Warning!)';
+ }
+}
+
+/**
+ * Alter the configuration synchronization steps.
+ *
+ * @param array $sync_steps
+ * A one-dimensional array of \Drupal\Core\Config\ConfigImporter method names
+ * or callables that are invoked to complete the import, in the order that
+ * they will be processed. Each callable item defined in $sync_steps should
+ * either be a global function or a public static method. The callable should
+ * accept a $context array by reference. For example:
+ *
+ * function _additional_configuration_step(&$context) {
+ * // Do stuff.
+ * // If finished set $context['finished'] = 1.
+ * }
+ *
+ * For more information on creating batches, see the
+ * @link batch Batch operations @endlink documentation.
+ *
+ * @see callback_batch_operation()
+ * @see \Drupal\Core\Config\ConfigImporter::initialize()
+ */
+function hook_config_import_steps_alter(&$sync_steps, \Drupal\Core\Config\ConfigImporter $config_importer) {
+ $deletes = $config_importer->getUnprocessedConfiguration('delete');
+ if (isset($deletes['field.storage.node.body'])) {
+ $sync_steps[] = '_additional_configuration_step';
+ }
+}
+
+/**
+ * Alter config typed data definitions.
+ *
+ * For example you can alter the typed data types representing each
+ * configuration schema type to change default labels or form element renderers
+ * used for configuration translation.
+ *
+ * If implementations of this hook add or remove configuration schema a
+ * ConfigSchemaAlterException will be thrown. Keep in mind that there are tools
+ * that may use the configuration schema for static analysis of configuration
+ * files, like the string extractor for the localization system. Such systems
+ * won't work with dynamically defined configuration schemas.
+ *
+ * For adding new data types use configuration schema YAML files instead.
+ *
+ * @param $definitions
+ * Associative array of configuration type definitions keyed by schema type
+ * names. The elements are themselves array with information about the type.
+ *
+ * @see \Drupal\Core\Config\TypedConfigManager
+ * @see \Drupal\Core\Config\Schema\ConfigSchemaAlterException
+ */
+function hook_config_schema_info_alter(&$definitions) {
+ // Enhance the text and date type definitions with classes to generate proper
+ // form elements in ConfigTranslationFormBase. Other translatable types will
+ // appear as a one line textfield.
+ $definitions['text']['form_element_class'] = '\Drupal\config_translation\FormElement\Textarea';
+ $definitions['date_format']['form_element_class'] = '\Drupal\config_translation\FormElement\DateFormat';
+}
+
+/**
* @} End of "addtogroup hooks".
*/
diff --git a/core/modules/system/tests/modules/session_test/session_test.module b/core/modules/system/tests/modules/session_test/session_test.module
index 6a08211..0fb2ae4 100644
--- a/core/modules/system/tests/modules/session_test/session_test.module
+++ b/core/modules/system/tests/modules/session_test/session_test.module
@@ -9,6 +9,4 @@ function session_test_user_login($account) {
// before hook_user_login() was called.
exit;
}
- // Add some data in the session for retrieval testing purpose.
- \Drupal::request()->getSession()->set("session_test_key", "foobar");
}
diff --git a/core/modules/system/tests/modules/session_test/session_test.routing.yml b/core/modules/system/tests/modules/session_test/session_test.routing.yml
index fce0fc9..8b9393e 100644
--- a/core/modules/system/tests/modules/session_test/session_test.routing.yml
+++ b/core/modules/system/tests/modules/session_test/session_test.routing.yml
@@ -5,13 +5,7 @@ session_test.get:
_controller: '\Drupal\session_test\Controller\SessionTestController::get'
requirements:
_access: 'TRUE'
-session_test.get_from_session_object:
- path: '/session-test/get-from-session-object'
- defaults:
- _title: 'Session value'
- _controller: '\Drupal\session_test\Controller\SessionTestController::getFromSessionObject'
- requirements:
- _access: 'TRUE'
+
session_test.id:
path: '/session-test/id'
defaults:
diff --git a/core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php b/core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php
index 4437743..1ae9a79 100644
--- a/core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php
+++ b/core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php
@@ -31,19 +31,6 @@ public function get() {
}
/**
- * Prints the stored session value to the screen.
- *
- * @return string
- * A notification message.
- */
- public function getFromSessionObject() {
- $value = \Drupal::request()->getSession()->get("session_test_key");
- return empty($value)
- ? []
- : ['#markup' => $this->t('The current value of the stored session variable is: %val', array('%val' => $value))];
- }
-
- /**
* Print the current session ID.
*
* @return string
diff --git a/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php b/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php
index 87d813d..5738087 100644
--- a/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php
+++ b/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php
@@ -205,19 +205,6 @@ public function system_test_cache_tags_page() {
}
/**
- * Set cache max-age on the returned render array.
- */
- public function system_test_cache_maxage_page() {
- $build['main'] = array(
- '#cache' => array('max-age' => 90),
- 'message' => array(
- '#markup' => 'Cache max-age page example',
- ),
- );
- return $build;
- }
-
- /**
* Sets a cache tag on an element to help test #pre_render and cache tags.
*/
public static function preRenderCacheTags($elements) {
diff --git a/core/modules/system/tests/modules/system_test/system_test.routing.yml b/core/modules/system/tests/modules/system_test/system_test.routing.yml
index ecb9921..0ceda63 100644
--- a/core/modules/system/tests/modules/system_test/system_test.routing.yml
+++ b/core/modules/system/tests/modules/system_test/system_test.routing.yml
@@ -66,13 +66,6 @@ system_test.cache_tags_page:
requirements:
_access: 'TRUE'
-system_test.cache_maxage_page:
- path: '/system-test/cache_maxage_page'
- defaults:
- _controller: '\Drupal\system_test\Controller\SystemTestController::system_test_cache_maxage_page'
- requirements:
- _access: 'TRUE'
-
system_test.authorize_init:
path: '/system-test/authorize-init/{page_title}'
defaults:
diff --git a/core/modules/system/theme.api.php b/core/modules/system/theme.api.php
index 9e08b87..a9a6f61 100644
--- a/core/modules/system/theme.api.php
+++ b/core/modules/system/theme.api.php
@@ -1,11 +1,6 @@
'block-content-add-list',
- * 'path' => 'core/themes/seven/templates',
- * 'type' => 'theme_engine',
- * 'theme path' => 'core/themes/seven',
- * 'includes' => array (
- * 0 => 'core/modules/block_content/block_content.pages.inc',
- * ),
- * 'variables' => array (
- * 'content' => NULL,
+ * $theme_registry['user'] = array(
+ * 'variables' => array(
+ * 'account' => NULL,
* ),
- * 'preprocess functions' => array (
+ * 'template' => 'core/modules/user/user',
+ * 'file' => 'core/modules/user/user.pages.inc',
+ * 'type' => 'module',
+ * 'theme path' => 'core/modules/user',
+ * 'preprocess functions' => array(
* 0 => 'template_preprocess',
- * 1 => 'template_preprocess_block_content_add_list',
- * 2 => 'contextual_preprocess',
- * 3 => 'seven_preprocess_block_content_add_list',
+ * 1 => 'template_preprocess_user_profile',
* ),
* );
* @endcode
diff --git a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTidDepth.php b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTidDepth.php
index d46ea0f..eee3a75 100644
--- a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTidDepth.php
+++ b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTidDepth.php
@@ -70,8 +70,12 @@ public function query() {
$this->tableAlias = $this->relationship;
}
// If no relationship, then use the alias of the base table.
+ elseif (isset($this->query->table_queue[$this->view->storage->get('base_table')]['alias'])) {
+ $this->tableAlias = $this->query->table_queue[$this->view->storage->get('base_table')]['alias'];
+ }
+ // This should never happen, but if it does, we fail quietly.
else {
- $this->tableAlias = $this->query->ensureTable($this->view->storage->get('base_table'));
+ return;
}
// Now build the subqueries.
diff --git a/core/modules/taxonomy/src/Tests/Views/TaxonomyTermFilterDepthTest.php b/core/modules/taxonomy/src/Tests/Views/TaxonomyTermFilterDepthTest.php
deleted file mode 100644
index 2704c9f..0000000
--- a/core/modules/taxonomy/src/Tests/Views/TaxonomyTermFilterDepthTest.php
+++ /dev/null
@@ -1,141 +0,0 @@
-createTerm(['name' => 'First']);
- $second = $this->createTerm(['name' => 'Second', 'parent' => $first->id()]);
- $third = $this->createTerm(['name' => 'Third', 'parent' => $second->id()]);
-
- // Create a node w/o any terms.
- $settings = ['type' => 'article'];
- $this->nodes[] = $this->drupalCreateNode($settings);
-
- // Create a node with only the top level term.
- $settings['field_views_testing_tags'][0]['target_id'] = $first->id();
- $this->nodes[] = $this->drupalCreateNode($settings);
-
- // Create a node with only the third level term.
- $settings['field_views_testing_tags'][0]['target_id'] = $third->id();
- $this->nodes[] = $this->drupalCreateNode($settings);
-
- $this->terms[0] = $first;
- $this->terms[1] = $second;
- $this->terms[2] = $third;
-
- $this->view = Views::getView('test_filter_taxonomy_index_tid_depth');
- }
-
- /**
- * Tests the terms with depth filter.
- */
- public function testTermWithDepthFilter() {
- $column_map = ['nid' => 'nid'];
- $assert_method = 'assertIdentical';
-
- // Default view has an empty value for this filter, so all nodes should be
- // returned.
- $expected = [
- ['nid' => 1],
- ['nid' => 2],
- ['nid' => 3],
- ['nid' => 4],
- ['nid' => 5],
- ];
- $this->executeView($this->view);
- $this->assertIdenticalResultsetHelper($this->view, $expected, $column_map, $assert_method);
-
- // Set filter to search on top-level term, with depth 0.
- $expected = [['nid' => 4]];
- $this->assertTermWithDepthResult($this->terms[0]->id(), 0, $expected);
-
- // Top-level term, depth 1.
- $expected = [['nid' => 4]];
- $this->assertTermWithDepthResult($this->terms[0]->id(), 0, $expected);
-
- // Top-level term, depth 2.
- $expected = [['nid' => 4], ['nid' => 5]];
- $this->assertTermWithDepthResult($this->terms[0]->id(), 2, $expected);
-
- // Second-level term, depth 1.
- $expected = [['nid' => 5]];
- $this->assertTermWithDepthResult($this->terms[1]->id(), 1, $expected);
-
- // Third-level term, depth 0.
- $expected = [['nid' => 5]];
- $this->assertTermWithDepthResult($this->terms[2]->id(), 0, $expected);
-
- // Third-level term, depth 1.
- $expected = [['nid' => 5]];
- $this->assertTermWithDepthResult($this->terms[2]->id(), 1, $expected);
-
- // Third-level term, depth -2.
- $expected = [['nid' => 4], ['nid' => 5]];
- $this->assertTermWithDepthResult($this->terms[2]->id(), -2, $expected);
- }
-
- /**
- * Changes the tid filter to given term and depth.
- *
- * @param integer $tid
- * The term ID to filter on.
- * @param integer $depth
- * The depth to search.
- * @param array $expected
- * The expected views result.
- */
- protected function assertTermWithDepthResult($tid, $depth, array $expected) {
- $this->view->destroy();
- $this->view->initDisplay();
- $filters = $this->view->displayHandlers->get('default')
- ->getOption('filters');
- $filters['tid_depth']['depth'] = $depth;
- $filters['tid_depth']['value'] = [$tid];
- $this->view->displayHandlers->get('default')
- ->setOption('filters', $filters);
- $this->executeView($this->view);
- $this->assertIdenticalResultsetHelper($this->view, $expected, ['nid' => 'nid'], 'assertIdentical');
- }
-
-}
diff --git a/core/modules/taxonomy/src/Tests/Views/TaxonomyTermViewTest.php b/core/modules/taxonomy/src/Tests/Views/TaxonomyTermViewTest.php
index ebe47dc..78f0d8c 100644
--- a/core/modules/taxonomy/src/Tests/Views/TaxonomyTermViewTest.php
+++ b/core/modules/taxonomy/src/Tests/Views/TaxonomyTermViewTest.php
@@ -81,7 +81,7 @@ protected function setUp() {
*/
public function testTaxonomyTermView() {
// Create terms in the vocabulary.
- $term = $this->createTerm();
+ $term = $this->createTerm($this->vocabulary);
// Post an article.
$edit = array();
diff --git a/core/modules/taxonomy/src/Tests/Views/TaxonomyTestBase.php b/core/modules/taxonomy/src/Tests/Views/TaxonomyTestBase.php
index d4479f1..9fa56bc 100644
--- a/core/modules/taxonomy/src/Tests/Views/TaxonomyTestBase.php
+++ b/core/modules/taxonomy/src/Tests/Views/TaxonomyTestBase.php
@@ -121,24 +121,20 @@ protected function mockStandardInstall() {
/**
* Returns a new term with random properties in vocabulary $vid.
*
- * @param array $settings
- * (Optional) An associative array of settings to pass to `entity_create`.
- *
- * @return \Drupal\taxonomy\Entity\Term
+ * @return \Drupal\taxonomy\Term
* The created taxonomy term.
*/
- protected function createTerm(array $settings = []) {
+ protected function createTerm() {
$filter_formats = filter_formats();
$format = array_pop($filter_formats);
- $settings += [
+ $term = entity_create('taxonomy_term', array(
'name' => $this->randomMachineName(),
'description' => $this->randomMachineName(),
// Use the first available text format.
'format' => $format->id(),
'vid' => $this->vocabulary->id(),
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
- ];
- $term = entity_create('taxonomy_term', $settings);
+ ));
$term->save();
return $term;
}
diff --git a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid_depth.yml b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid_depth.yml
deleted file mode 100644
index 500e8b9..0000000
--- a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid_depth.yml
+++ /dev/null
@@ -1,178 +0,0 @@
-langcode: en
-status: true
-dependencies:
- module:
- - node
- - taxonomy
- - user
-id: test_filter_taxonomy_index_tid_depth
-label: test_filter_taxonomy_index_tid_depth
-module: views
-description: ''
-tag: ''
-base_table: node_field_data
-base_field: nid
-core: 8.x
-display:
- default:
- display_plugin: default
- id: default
- display_title: Master
- position: 1
- display_options:
- access:
- type: perm
- options:
- perm: 'access content'
- cache:
- type: none
- options: { }
- query:
- type: views_query
- options:
- disable_sql_rewrite: false
- distinct: false
- replica: false
- query_comment: ''
- query_tags: { }
- exposed_form:
- type: basic
- options:
- submit_button: Apply
- reset_button: false
- reset_button_label: Reset
- exposed_sorts_label: 'Sort by'
- expose_sort_order: true
- sort_asc_label: Asc
- sort_desc_label: Desc
- pager:
- type: full
- options:
- items_per_page: 10
- offset: 0
- id: 0
- total_pages: null
- expose:
- items_per_page: false
- items_per_page_label: 'Items per page'
- items_per_page_options: '5, 10, 25, 50'
- items_per_page_options_all: false
- items_per_page_options_all_label: '- All -'
- offset: false
- offset_label: Offset
- tags:
- previous: '‹ previous'
- next: 'next ›'
- first: '« first'
- last: 'last »'
- quantity: 9
- style:
- type: default
- options:
- grouping: { }
- row_class: ''
- default_row_class: true
- uses_fields: false
- row:
- type: fields
- options:
- inline: { }
- separator: ''
- hide_empty: false
- default_field_elements: true
- fields:
- title:
- id: title
- table: node_field_data
- field: title
- label: ''
- alter:
- alter_text: false
- make_link: false
- absolute: false
- trim: false
- word_boundary: false
- ellipsis: false
- strip_tags: false
- html: false
- hide_empty: false
- empty_zero: false
- relationship: none
- group_type: group
- admin_label: ''
- exclude: false
- element_type: ''
- element_class: ''
- element_label_type: ''
- element_label_class: ''
- element_label_colon: true
- element_wrapper_type: ''
- element_wrapper_class: ''
- element_default_classes: true
- empty: ''
- hide_alter_empty: true
- plugin_id: field
- entity_type: node
- entity_field: title
- filters:
- status:
- value: true
- table: node_field_data
- field: status
- id: status
- expose:
- operator: '0'
- group: 1
- plugin_id: boolean
- entity_type: node
- entity_field: status
- tid_depth:
- id: tid_depth
- table: node_field_data
- field: term_node_tid_depth
- relationship: none
- group_type: group
- admin_label: ''
- operator: or
- value: { }
- group: 1
- exposed: false
- expose:
- operator_id: '0'
- label: ''
- description: ''
- use_operator: false
- operator: ''
- identifier: ''
- required: false
- remember: false
- multiple: false
- remember_roles:
- authenticated: authenticated
- reduce: false
- is_grouped: false
- group_info:
- label: ''
- description: ''
- identifier: ''
- optional: true
- widget: select
- multiple: false
- remember: false
- default_group: All
- default_group_multiple: { }
- group_items: { }
- reduce_duplicates: false
- type: select
- limit: true
- vid: views_testing_tags
- hierarchy: true
- depth: -2
- error_message: true
- plugin_id: taxonomy_index_tid_depth
- sorts: { }
- header: { }
- footer: { }
- empty: { }
- relationships: { }
- arguments: { }
diff --git a/core/modules/text/text.js b/core/modules/text/text.js
index 2ab1d0a..0895415 100644
--- a/core/modules/text/text.js
+++ b/core/modules/text/text.js
@@ -11,9 +11,9 @@
var $widget = $(this).closest('.text-format-wrapper');
var $summary = $widget.find('.text-summary-wrapper');
- var $summaryLabel = $summary.find('label').eq(0);
+ var $summaryLabel = $summary.find('label').first();
var $full = $widget.find('.text-full').closest('.form-item');
- var $fullLabel = $full.find('label').eq(0);
+ var $fullLabel = $full.find('label').first();
// Create a placeholder label when the field cardinality is greater
// than 1.
diff --git a/core/modules/tour/js/tour.js b/core/modules/tour/js/tour.js
index 8d85e10..f8bc85f 100644
--- a/core/modules/tour/js/tour.js
+++ b/core/modules/tour/js/tour.js
@@ -206,7 +206,7 @@
$(this).find('.tour-progress').text(progress);
})
// Update the last item to have "End tour" as the button.
- .eq(-1)
+ .last()
.attr('data-text', Drupal.t('End tour'));
}
}
diff --git a/core/modules/update/config/install/update.settings.yml b/core/modules/update/config/install/update.settings.yml
index 912a5b8..ded8c9d 100644
--- a/core/modules/update/config/install/update.settings.yml
+++ b/core/modules/update/config/install/update.settings.yml
@@ -1,4 +1,5 @@
check:
+ disabled_extensions: false
interval_days: 1
fetch:
url: ''
diff --git a/core/modules/update/config/schema/update.schema.yml b/core/modules/update/config/schema/update.schema.yml
index a390c6b..b827c56 100644
--- a/core/modules/update/config/schema/update.schema.yml
+++ b/core/modules/update/config/schema/update.schema.yml
@@ -8,6 +8,9 @@ update.settings:
type: mapping
label: 'Check settings'
mapping:
+ disabled_extensions:
+ type: boolean
+ label: 'Check for updates of disabled modules and themes'
interval_days:
type: integer
label: 'Days since last check'
diff --git a/core/modules/update/src/Form/UpdateManagerInstall.php b/core/modules/update/src/Form/UpdateManagerInstall.php
index 43d1f62..b3e2deb 100644
--- a/core/modules/update/src/Form/UpdateManagerInstall.php
+++ b/core/modules/update/src/Form/UpdateManagerInstall.php
@@ -104,7 +104,6 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
- '#button_type' => 'primary',
'#value' => $this->t('Install'),
);
diff --git a/core/modules/update/src/Tests/UpdateContribTest.php b/core/modules/update/src/Tests/UpdateContribTest.php
index b4ff5e4..dde3e52 100644
--- a/core/modules/update/src/Tests/UpdateContribTest.php
+++ b/core/modules/update/src/Tests/UpdateContribTest.php
@@ -250,6 +250,23 @@ function testUpdateShowDisabledThemes() {
);
$base_theme_project_link = \Drupal::l(t('Update test base theme'), Url::fromUri('http://example.com/project/update_test_basetheme'));
$sub_theme_project_link = \Drupal::l(t('Update test subtheme'), Url::fromUri('http://example.com/project/update_test_subtheme'));
+ foreach (array(TRUE, FALSE) as $check_disabled) {
+ $update_settings->set('check.disabled_extensions', $check_disabled)->save();
+ $this->refreshUpdateStatus($xml_mapping);
+ // In neither case should we see the "Themes" heading for installed
+ // themes.
+ $this->assertNoText(t('Themes'));
+ if ($check_disabled) {
+ $this->assertText(t('Disabled themes'));
+ $this->assertRaw($base_theme_project_link, 'Link to the Update test base theme project appears.');
+ $this->assertRaw($sub_theme_project_link, 'Link to the Update test subtheme project appears.');
+ }
+ else {
+ $this->assertNoText(t('Disabled themes'));
+ $this->assertNoRaw($base_theme_project_link, 'Link to the Update test base theme project does not appear.');
+ $this->assertNoRaw($sub_theme_project_link, 'Link to the Update test subtheme project does not appear.');
+ }
+ }
}
/**
diff --git a/core/modules/update/src/UpdateManager.php b/core/modules/update/src/UpdateManager.php
index 3b052af..b92251b 100644
--- a/core/modules/update/src/UpdateManager.php
+++ b/core/modules/update/src/UpdateManager.php
@@ -138,6 +138,10 @@ public function getProjects() {
$project_info = new ProjectInfo();
$project_info->processInfoList($this->projects, $module_data, 'module', TRUE);
$project_info->processInfoList($this->projects, $theme_data, 'theme', TRUE);
+ if ($this->updateSettings->get('check.disabled_extensions')) {
+ $project_info->processInfoList($this->projects, $module_data, 'module', FALSE);
+ $project_info->processInfoList($this->projects, $theme_data, 'theme', FALSE);
+ }
// Allow other modules to alter projects before fetching and comparing.
$this->moduleHandler->alter('update_projects', $this->projects);
// Store the site's project data for at most 1 hour.
diff --git a/core/modules/update/src/UpdateSettingsForm.php b/core/modules/update/src/UpdateSettingsForm.php
index a824c9b..7b29880 100644
--- a/core/modules/update/src/UpdateSettingsForm.php
+++ b/core/modules/update/src/UpdateSettingsForm.php
@@ -75,6 +75,12 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#description' => t('Select how frequently you want to automatically check for new releases of your currently installed modules and themes.'),
);
+ $form['update_check_disabled'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Check for updates of disabled modules and themes'),
+ '#default_value' => $config->get('check.disabled_extensions'),
+ );
+
$notification_emails = $config->get('notification.emails');
$form['update_notify_emails'] = array(
'#type' => 'textarea',
@@ -136,8 +142,14 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this->config('update.settings');
+ // See if the update_check_disabled setting is being changed, and if so,
+ // invalidate all update status data.
+ if ($form_state->getValue('update_check_disabled') != $config->get('check.disabled_extensions')) {
+ update_storage_clear();
+ }
$config
+ ->set('check.disabled_extensions', $form_state->getValue('update_check_disabled'))
->set('check.interval_days', $form_state->getValue('update_check_frequency'))
->set('notification.emails', $form_state->get('notify_emails'))
->set('notification.threshold', $form_state->getValue('update_notification_threshold'))
diff --git a/core/modules/user/src/Tests/UserSaveStatusTest.php b/core/modules/user/src/Tests/UserSaveStatusTest.php
deleted file mode 100644
index d1410a1..0000000
--- a/core/modules/user/src/Tests/UserSaveStatusTest.php
+++ /dev/null
@@ -1,53 +0,0 @@
-installEntitySchema('user');
- }
-
- /**
- * Test SAVED_NEW and SAVED_UPDATED statuses for user entity type.
- */
- function testUserSaveStatus() {
- // Create a new user.
- $values = array(
- 'uid' => 1,
- 'name' => $this->randomMachineName(),
- );
- $user = User::create($values);
-
- // Test SAVED_NEW.
- $return = $user->save();
- $this->assertEqual($return, SAVED_NEW, "User was saved with SAVED_NEW status.");
-
- // Test SAVED_UPDATED.
- $user->name = $this->randomMachineName();
- $return = $user->save();
- $this->assertEqual($return, SAVED_UPDATED, "User was saved with SAVED_UPDATED status.");
- }
-
-}
diff --git a/core/modules/user/src/UserStorage.php b/core/modules/user/src/UserStorage.php
index 4aad5c5..f404b8d 100644
--- a/core/modules/user/src/UserStorage.php
+++ b/core/modules/user/src/UserStorage.php
@@ -79,7 +79,7 @@ public function save(EntityInterface $entity) {
$entity->uid->value = $this->database->nextId($this->database->query('SELECT MAX(uid) FROM {users}')->fetchField());
$entity->enforceIsNew();
}
- return parent::save($entity);
+ parent::save($entity);
}
/**
diff --git a/core/modules/views/src/Plugin/views/PluginBase.php b/core/modules/views/src/Plugin/views/PluginBase.php
index 9c0f49b..e648cb6 100644
--- a/core/modules/views/src/Plugin/views/PluginBase.php
+++ b/core/modules/views/src/Plugin/views/PluginBase.php
@@ -507,14 +507,17 @@ public function getProvider() {
* - \Drupal\views\Plugin\views\PluginBase::INCLUDE_ENTITY: Add
* entity row language types. Note that these are only supported for
* display options, not substituted in queries.
+ * @param array|null $current_values
+ * The list of current values if available.
*
* @return array
* An array of language names, keyed by the language code. Negotiated and
* special languages have special codes that are substituted in queries by
* PluginBase::queryLanguageSubstitutions().
*/
- protected function listLanguages($flags = LanguageInterface::STATE_ALL) {
+ protected function listLanguages($flags = LanguageInterface::STATE_ALL, array $current_values = NULL) {
$manager = \Drupal::languageManager();
+ $languages = $manager->getLanguages($flags);
$list = array();
// The entity languages should come first, if requested.
@@ -523,32 +526,46 @@ protected function listLanguages($flags = LanguageInterface::STATE_ALL) {
$list['***LANGUAGE_entity_default***'] = $this->t('Original language of content in view row');
}
- // The Language Manager class takes care of the STATE_SITE_DEFAULT case.
- // It comes in with ID set to LanguageInterface::LANGCODE_SITE_DEFAULT.
+ // STATE_SITE_DEFAULT comes in with ID set to LanguageInterface::LANGCODE_SITE_DEFAULT.
// Since this is not a real language, surround it by '***LANGUAGE_...***',
// like the negotiated languages below.
- $languages = $manager->getLanguages($flags);
- foreach ($languages as $id => $language) {
- if ($id == LanguageInterface::LANGCODE_SITE_DEFAULT) {
- $id = PluginBase::VIEWS_QUERY_LANGUAGE_SITE_DEFAULT;
- }
- $list[$id] = $this->t($language->getName());
+ if ($flags & LanguageInterface::STATE_SITE_DEFAULT) {
+ $list[PluginBase::VIEWS_QUERY_LANGUAGE_SITE_DEFAULT] = $this->t($languages[LanguageInterface::LANGCODE_SITE_DEFAULT]->getName());
+ // Remove site's default from the languages' array so it's not added
+ // with the real languages below.
+ unset($languages[LanguageInterface::LANGCODE_SITE_DEFAULT]);
}
// Add in negotiated languages, if requested.
if ($flags & PluginBase::INCLUDE_NEGOTIATED) {
- $types = $manager->getDefinedLanguageTypesInfo();
- foreach ($types as $id => $type) {
- // Omit unnamed types. These are things like language_url, which are
- // not configurable and do not need to be in this list. And surround
- // IDs by '***LANGUAGE_...***', to avoid query collisions.
- if (isset($type['name'])) {
+ $types_info = $manager->getDefinedLanguageTypesInfo();
+ $types = $manager->getLanguageTypes();
+ foreach ($types as $id) {
+ if (isset($types_info[$id]['name'])) {
+ $name = $types_info[$id]['name'];
+ // Surround IDs by '***LANGUAGE_...***', to avoid query collisions.
+ $id = '***LANGUAGE_' . $id . '***';
+ $list[$id] = $this->t('!type language selected for page', array('!type' => $name));
+ }
+ }
+ if (!empty($current_values)) {
+ foreach ($types_info as $id => $type) {
$id = '***LANGUAGE_' . $id . '***';
- $list[$id] = $this->t('!type language selected for page', array('!type' => $type['name']));
+ // If this (non-configurable) type is among the current values,
+ // add that option too, so it is not lost. If not among the current
+ // values, skip displaying it to avoid user confusion.
+ if (isset($type['name']) && !isset($list[$id]) && in_array($id, $current_values)) {
+ $list[$id] = $this->t('!type language selected for page', array('!type' => $type['name']));
+ }
}
}
}
+ // Add real languages.
+ foreach ($languages as $id => $language) {
+ $list[$id] = $this->t($language->getName());
+ }
+
return $list;
}
diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
index 290d1a7..b66cdce 100644
--- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
+++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
@@ -2609,7 +2609,9 @@ public function getExtenders() {
*/
protected function buildRenderingLanguageOptions() {
// @todo Consider making these plugins. See https://drupal.org/node/2173811.
- return $this->listLanguages(LanguageInterface::STATE_CONFIGURABLE | LanguageInterface::STATE_SITE_DEFAULT | PluginBase::INCLUDE_NEGOTIATED | PluginBase::INCLUDE_ENTITY);
+ // Pass the current rendering language so is not lost when there is language
+ // configuration changes.
+ return $this->listLanguages(LanguageInterface::STATE_CONFIGURABLE | LanguageInterface::STATE_SITE_DEFAULT | PluginBase::INCLUDE_NEGOTIATED | PluginBase::INCLUDE_ENTITY, array($this->getOption('rendering_language')));
}
/**
diff --git a/core/modules/views/src/Plugin/views/filter/LanguageFilter.php b/core/modules/views/src/Plugin/views/filter/LanguageFilter.php
index 9826998..acf59e7 100644
--- a/core/modules/views/src/Plugin/views/filter/LanguageFilter.php
+++ b/core/modules/views/src/Plugin/views/filter/LanguageFilter.php
@@ -65,7 +65,9 @@ public static function create(ContainerInterface $container, array $configuratio
public function getValueOptions() {
if (!isset($this->valueOptions)) {
$this->valueTitle = $this->t('Language');
- $this->valueOptions = $this->listLanguages(LanguageInterface::STATE_ALL |LanguageInterface::STATE_SITE_DEFAULT | PluginBase::INCLUDE_NEGOTIATED);
+ // Pass the current values so options that are already selected do not get
+ // lost when there is changes in the language configuration.
+ $this->valueOptions = $this->listLanguages(LanguageInterface::STATE_ALL | LanguageInterface::STATE_SITE_DEFAULT | PluginBase::INCLUDE_NEGOTIATED, array_keys($this->value));
}
}
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display.yml
index 7b8490a..9a0b910 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display.yml
@@ -39,6 +39,46 @@ display:
plugin_id: boolean
entity_type: node
entity_field: status
+ langcode:
+ id: langcode
+ table: node_field_data
+ field: langcode
+ relationship: none
+ group_type: group
+ admin_label: ''
+ operator: in
+ value:
+ '***LANGUAGE_language_content***': '***LANGUAGE_language_content***'
+ group: 1
+ exposed: false
+ expose:
+ operator_id: ''
+ label: ''
+ description: ''
+ use_operator: false
+ operator: ''
+ identifier: ''
+ required: false
+ remember: false
+ multiple: false
+ remember_roles:
+ authenticated: authenticated
+ reduce: false
+ is_grouped: false
+ group_info:
+ label: ''
+ description: ''
+ identifier: ''
+ optional: true
+ widget: select
+ multiple: false
+ remember: false
+ default_group: All
+ default_group_multiple: { }
+ group_items: { }
+ plugin_id: language
+ entity_type: node
+ entity_field: langcode
pager:
options:
items_per_page: 10
diff --git a/core/modules/views_ui/js/views-admin.js b/core/modules/views_ui/js/views-admin.js
index 7f217dc..236b746 100644
--- a/core/modules/views_ui/js/views-admin.js
+++ b/core/modules/views_ui/js/views-admin.js
@@ -241,7 +241,7 @@
var $addDisplayDropdown = $('