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:
parent
0a95b8440e
commit
8544b60b39
284 changed files with 12980 additions and 3199 deletions
|
@ -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'
|
||||
|
|
|
@ -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().
|
||||
*/
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace Drupal\entity_test\Entity;
|
|||
class EntityTestNoLabel extends EntityTest {
|
||||
|
||||
/**
|
||||
* @{inheritdoc}
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function label() {
|
||||
return $this->getName();
|
||||
|
|
|
@ -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}",
|
||||
|
|
|
@ -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}
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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'));
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue