Update to Drupal 8.2.4. For more information, see https://www.drupal.org/project/drupal/releases/8.2.4

This commit is contained in:
Pantheon Automation 2016-12-07 12:19:38 -08:00 committed by Greg Anderson
parent 0a95b8440e
commit 8544b60b39
284 changed files with 12980 additions and 3199 deletions

View file

@ -0,0 +1,29 @@
id: d7_global_theme_settings
label: D7 global theme settings
migration_tags:
- Drupal 7
source:
plugin: variable
variables:
- theme_settings
process:
'features/logo': theme_settings/toggle_logo
'features/name': theme_settings/toggle_name
'features/slogan': theme_settings/toggle_slogan
'features/node_user_picture': theme_settings/toggle_node_user_picture
'features/comment_user_picture': theme_settings/toggle_comment_user_picture
'features/comment_user_verification': theme_settings/toggle_comment_user_verification
'features/favicon': theme_settings/toggle_favicon
'logo/use_default': theme_settings/default_logo
'logo/path': theme_settings/logo_path
'favicon/use_default': theme_settings/default_favicon
'favicon/path': theme_settings/favicon_path
'favicon/mimetype': theme_settings/favicon_mimetype
# Ignore settings not present in Drupal 8
# theme_settings/logo_upload
# theme_settings/favicon_upload
# theme_settings/toggle_main_menu
# theme_settings/toggle_secondary_menu
destination:
plugin: config
config_name: system.theme.global

View file

@ -6,9 +6,9 @@ use Drupal\Component\Transliteration\TransliterationInterface;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Access\CsrfTokenGenerator;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@ -78,10 +78,10 @@ class MachineNameController implements ContainerInjectionInterface {
if (isset($replace_pattern) && isset($replace)) {
if (!isset($replace_token)) {
throw new AccessDeniedException("Missing 'replace_token' query parameter.");
throw new AccessDeniedHttpException("Missing 'replace_token' query parameter.");
}
elseif (!$this->tokenGenerator->validate($replace_token, $replace_pattern)) {
throw new AccessDeniedException("Invalid 'replace_token' query parameter.");
throw new AccessDeniedHttpException("Invalid 'replace_token' query parameter.");
}
// Quote the pattern delimiter and remove null characters to avoid the e

View file

@ -44,7 +44,7 @@ class InstallerConfigDirectorySetNoDirectoryErrorTest extends InstallerTestBase
}
/**
* @{inheritdoc}
* {@inheritdoc}
*/
protected function setUpSite() {
// This step should not appear as we had a failure prior to the settings

View file

@ -13,7 +13,7 @@ use Drupal\simpletest\InstallerTestBase;
class InstallerDatabaseErrorMessagesTest extends InstallerTestBase {
/**
* @{inheritdoc}
* {@inheritdoc}
*/
protected function setUpSettings() {
// We are creating a table here to force an error in the installer because
@ -25,7 +25,7 @@ class InstallerDatabaseErrorMessagesTest extends InstallerTestBase {
}
/**
* @{inheritdoc}
* {@inheritdoc}
*/
protected function setUpSite() {
// This step should not appear as we had a failure on the settings screen.

View file

@ -42,7 +42,7 @@ class InstallerTranslationTest extends InstallerTestBase {
}
/**
* @{inheritdoc}
* {@inheritdoc}
*/
protected function setUpSettings() {
// We are creating a table here to force an error in the installer because

View file

@ -54,6 +54,14 @@ class HtmlResponseAttachmentsTest extends WebTestBase {
// Repeat for the cache.
$this->drupalGet('/render_attached_test/head');
$this->assertHeader('X-Drupal-Cache', 'HIT');
// Test ['#attached']['html_head_link'] when outputted as HTTP header.
$this->drupalGet('/render_attached_test/html_header_link');
$expected_link_headers = [
'</foo?bar=&lt;baz&gt;&amp;baz=false>; rel="alternate"',
'</foo/bar>; hreflang="nl"; rel="alternate"',
];
$this->assertEqual($this->drupalGetHeader('link'), implode(',', $expected_link_headers));
}
/**

View file

@ -8,11 +8,11 @@
* - links: Links to be output.
* Each link will have the following elements:
* - title: The link text.
* - href: The link URL. If omitted, the 'title' is shown as a plain text
* item in the links list. If 'href' is supplied, the entire link is passed
* - url: The link URL. If omitted, the 'title' is shown as a plain text
* item in the links list. If 'url' is supplied, the entire link is passed
* to l() as its $options parameter.
* - attributes: (optional) HTML attributes for the anchor, or for the <span>
* tag if no 'href' is supplied.
* tag if no 'url' is supplied.
* - heading: (optional) A heading to precede the links.
* - text: The heading text.
* - level: The heading level (e.g. 'h2', 'h3').

View file

@ -27,3 +27,19 @@ entity_test.entity_test_bundle.*:
description:
type: text
label: 'Description'
entity_test.entity_test_bundle.*.third_party.content_moderation:
type: mapping
label: 'Enable moderation states for this entity test type'
mapping:
enabled:
type: boolean
label: 'Moderation states enabled'
allowed_moderation_states:
type: sequence
sequence:
type: string
label: 'Moderation state'
default_moderation_state:
type: string
label: 'Moderation state for new entity test'

View file

@ -95,12 +95,26 @@ function entity_test_entity_type_alter(array &$entity_types) {
// Allow entity_test_update tests to override the entity type definition.
$entity_types['entity_test_update'] = $state->get('entity_test_update.entity_type', $entity_types['entity_test_update']);
// Allow entity_test_with_bundle tests to override the entity type definition.
$entity_types['entity_test_with_bundle'] = $state->get('entity_test_with_bundle.entity_type', $entity_types['entity_test_with_bundle']);
// Enable the entity_test_new only when needed.
if (!$state->get('entity_test_new')) {
unset($entity_types['entity_test_new']);
}
}
/**
* Implements hook_module_implements_alter().
*/
function entity_test_module_implements_alter(&$implementations, $hook) {
// Move our hook_entity_type_alter() implementation to the beginning of the
// list in order to run before content_moderation_entity_type_alter().
if ($hook === 'entity_type_alter') {
$implementations = ['entity_test' => $implementations['entity_test']] + $implementations;
}
}
/**
* Implements hook_entity_base_field_info().
*/

View file

@ -19,7 +19,7 @@ namespace Drupal\entity_test\Entity;
class EntityTestNoLabel extends EntityTest {
/**
* @{inheritdoc}
* {@inheritdoc}
*/
public function label() {
return $this->getName();

View file

@ -25,7 +25,8 @@ use Drupal\Core\Entity\EntityTypeInterface;
* entity_keys = {
* "id" = "id",
* "uuid" = "uuid",
* "bundle" = "type"
* "bundle" = "type",
* "label" = "name",
* },
* links = {
* "canonical" = "/entity_test_string_id/manage/{entity_test_string_id}",

View file

@ -2,7 +2,6 @@
namespace Drupal\entity_test;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityViewBuilder;
/**
@ -12,15 +11,6 @@ use Drupal\Core\Entity\EntityViewBuilder;
*/
class EntityTestViewBuilder extends EntityViewBuilder {
/**
* {@inheritdoc}
*/
protected function getBuildDefaults(EntityInterface $entity, $view_mode) {
$build = parent::getBuildDefaults($entity, $view_mode);
unset($build['#theme']);
return $build;
}
/**
* {@inheritdoc}
*/

View file

@ -0,0 +1,40 @@
<?php
namespace Drupal\entity_test\Plugin\Field\FieldWidget;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\WidgetBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Plugin implementation of the 'shape_only_color_editable_widget' widget.
*
* @FieldWidget(
* id = "shape_only_color_editable_widget",
* label = @Translation("Shape widget with only color editable property"),
* field_types = {
* "shape"
* },
* )
*/
class ShapeOnlyColorEditableWidget extends WidgetBase {
/**
* {@inheritdoc}
*/
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$element['shape'] = [
'#type' => 'hidden',
'#value' => $items[$delta]->shape
];
$element['color'] = [
'#type' => 'textfield',
'#default_value' => isset($items[$delta]->color) ? $items[$delta]->color : NULL,
'#size' => 255,
];
return $element;
}
}

View file

@ -19,6 +19,13 @@ render_attached.head:
requirements:
_access: 'TRUE'
render_attached.html_header_link:
path: '/render_attached_test/html_header_link'
defaults:
_controller: '\Drupal\render_attached_test\Controller\RenderAttachedTestController::htmlHeaderLink'
requirements:
_access: 'TRUE'
render_attached.feed_single:
path: '/render_attached_test/feed'
defaults:

View file

@ -69,4 +69,18 @@ class RenderAttachedTestController {
return $render;
}
/**
* Test HTTP header rendering for link.
*
* @return array
* A render array using the 'html_head_link' directive.
*/
public function htmlHeaderLink() {
$render = [];
$render['#attached']['html_head_link'][] = [['href' => '/foo?bar=<baz>&baz=false', 'rel' => 'alternate'], TRUE];
$render['#attached']['html_head_link'][] = [['href' => '/not-added-to-http-headers', 'rel' => 'alternate'], FALSE];
$render['#attached']['html_head_link'][] = [['href' => '/foo/bar', 'hreflang' => 'nl', 'rel' => 'alternate'], TRUE];
return $render;
}
}

View file

@ -0,0 +1,49 @@
<?php
namespace Drupal\Tests\system\Kernel\Migrate\d7;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
/**
* Tests migration of global theme settings variables to configuration.
*
* @group system
*/
class MigrateGlobalThemeSettingsTest extends MigrateDrupal7TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['system'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->executeMigration('d7_global_theme_settings');
}
/**
* Tests migration of global theme settings to configuration.
*/
public function testMigrateThemeSettings() {
$config = $this->config('system.theme.global');
$this->assertSame('image/png', $config->get('favicon.mimetype'));
$this->assertSame('public://somefavicon.png', $config->get('favicon.path'));
$this->assertFalse($config->get('favicon.use_default'));
$this->assertFalse($config->get('features.comment_user_picture'));
$this->assertFalse($config->get('features.comment_user_verification'));
$this->assertFalse($config->get('features.favicon'));
$this->assertFalse($config->get('features.node_user_picture'));
$this->assertFalse($config->get('features.logo'));
$this->assertTrue($config->get('features.name'));
$this->assertFalse($config->get('features.slogan'));
$this->assertSame('public://customlogo.png', $config->get('logo.path'));
$this->assertTrue($config->get('logo.use_default'));
}
}

View file

@ -7,8 +7,8 @@ use Drupal\Tests\UnitTestCase;
use Drupal\Component\Transliteration\PhpTransliteration;
use Drupal\system\MachineNameController;
use Prophecy\Argument;
use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
/**
* Tests that the machine name controller can transliterate strings as expected.
@ -103,7 +103,7 @@ class MachineNameControllerTest extends UnitTestCase {
public function testMachineNameControllerWithInvalidReplacePattern() {
$request = Request::create('', 'GET', ['text' => 'Bob', 'langcode' => 'en', 'replace' => 'Alice', 'replace_pattern' => 'Bob', 'replace_token' => 'invalid']);
$this->setExpectedException(AccessDeniedException::class, "Invalid 'replace_token' query parameter.");
$this->setExpectedException(AccessDeniedHttpException::class, "Invalid 'replace_token' query parameter.");
$this->machineNameController->transliterate($request);
}
@ -113,7 +113,7 @@ class MachineNameControllerTest extends UnitTestCase {
public function testMachineNameControllerWithMissingToken() {
$request = Request::create('', 'GET', ['text' => 'Bob', 'langcode' => 'en', 'replace' => 'Alice', 'replace_pattern' => 'Bob']);
$this->setExpectedException(AccessDeniedException::class, "Missing 'replace_token' query parameter.");
$this->setExpectedException(AccessDeniedHttpException::class, "Missing 'replace_token' query parameter.");
$this->machineNameController->transliterate($request);
}