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

@ -81,7 +81,7 @@ class Drupal {
/**
* The current system version.
*/
const VERSION = '8.2.3';
const VERSION = '8.2.4';
/**
* Core API compatibility.

View file

@ -36,6 +36,16 @@ class DiffFormatter {
*/
public $trailing_context_lines = 0;
/**
* The line stats.
*
* @var array
*/
protected $line_stats = array(
'counter' => array('x' => 0, 'y' => 0),
'offset' => array('x' => 0, 'y' => 0),
);
/**
* Format a diff.
*

View file

@ -54,7 +54,7 @@ class CsrfAccessCheck implements RoutingAccessInterface {
$path = str_replace("{{$param}}", $value, $path);
}
if ($this->csrfToken->validate($request->query->get('token'), $path)) {
if ($this->csrfToken->validate($request->query->get('token', ''), $path)) {
$result = AccessResult::allowed();
}
else {

View file

@ -87,7 +87,7 @@ class CsrfTokenGenerator {
return FALSE;
}
return $token === $this->computeToken($seed, $value);
return Crypt::hashEquals($this->computeToken($seed, $value), $token);
}
/**

View file

@ -34,6 +34,11 @@ abstract class DraggableListBuilder extends ConfigEntityListBuilder implements F
*/
protected $weightKey = FALSE;
/**
* {@inheritdoc}
*/
protected $limit = FALSE;
/**
* The form builder.
*

View file

@ -19,16 +19,6 @@ class DiffFormatter extends DiffFormatterBase {
*/
protected $rows = array();
/**
* The line stats.
*
* @var array
*/
protected $line_stats = array(
'counter' => array('x' => 0, 'y' => 0),
'offset' => array('x' => 0, 'y' => 0),
);
/**
* Creates a DiffFormatter to render diffs in a table.
*

View file

@ -348,13 +348,10 @@ class EntityAutocomplete extends Textfield {
public static function extractEntityIdFromAutocompleteInput($input) {
$match = NULL;
// Take "label (entity id)', match the ID from parenthesis when it's a
// number.
if (preg_match("/.+\s\((\d+)\)/", $input, $matches)) {
$match = $matches[1];
}
// Match the ID when it's a string (e.g. for config entity types).
elseif (preg_match("/.+\s\(([\w.]+)\)/", $input, $matches)) {
// Take "label (entity id)', match the ID from inside the parentheses.
// @todo Add support for entities containing parentheses in their ID.
// @see https://www.drupal.org/node/2520416
if (preg_match("/.+\s\(([^\)]+)\)/", $input, $matches)) {
$match = $matches[1];
}

View file

@ -94,7 +94,7 @@ abstract class EntityDisplayBase extends ConfigEntityBase implements EntityDispl
protected $plugins = array();
/**
* Context in which this entity will be used (e.g. 'display', 'form').
* Context in which this entity will be used (e.g. 'view', 'form').
*
* @var string
*/

View file

@ -9,6 +9,7 @@ use Drupal\Core\Field\FieldItemInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Render\Element;
use Drupal\Core\Theme\Registry;
use Drupal\Core\TypedData\TranslatableInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -54,6 +55,13 @@ class EntityViewBuilder extends EntityHandlerBase implements EntityHandlerInterf
*/
protected $languageManager;
/**
* The theme registry.
*
* @var \Drupal\Core\Theme\Registry
*/
protected $themeRegistry;
/**
* The EntityViewDisplay objects created for individual field rendering.
*
@ -72,12 +80,15 @@ class EntityViewBuilder extends EntityHandlerBase implements EntityHandlerInterf
* The entity manager service.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
* @param \Drupal\Core\Theme\Registry $theme_registry
* The theme registry.
*/
public function __construct(EntityTypeInterface $entity_type, EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager) {
public function __construct(EntityTypeInterface $entity_type, EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager, Registry $theme_registry = NULL) {
$this->entityTypeId = $entity_type->id();
$this->entityType = $entity_type;
$this->entityManager = $entity_manager;
$this->languageManager = $language_manager;
$this->themeRegistry = $theme_registry ?: \Drupal::service('theme.registry');
}
/**
@ -87,7 +98,8 @@ class EntityViewBuilder extends EntityHandlerBase implements EntityHandlerInterf
return new static(
$entity_type,
$container->get('entity.manager'),
$container->get('language_manager')
$container->get('language_manager'),
$container->get('theme.registry')
);
}
@ -148,7 +160,6 @@ class EntityViewBuilder extends EntityHandlerBase implements EntityHandlerInterf
$this->moduleHandler()->alter('entity_view_mode', $view_mode, $entity, $context);
$build = array(
'#theme' => $this->entityTypeId,
"#{$this->entityTypeId}" => $entity,
'#view_mode' => $view_mode,
// Collect cache defaults for this entity.
@ -159,6 +170,11 @@ class EntityViewBuilder extends EntityHandlerBase implements EntityHandlerInterf
),
);
// Add the default #theme key if a template exists for it.
if ($this->themeRegistry->getRuntime()->has($this->entityTypeId)) {
$build['#theme'] = $this->entityTypeId;
}
// Cache the rendered output if permitted by the view mode and global entity
// type configuration.
if ($this->isViewModeCacheable($view_mode) && !$entity->isNew() && $entity->isDefaultRevision() && $this->entityType->isRenderCacheable()) {

View file

@ -35,13 +35,18 @@ interface QueryInterface extends AlterableInterface {
*
* @param $field
* Name of the field being queried. It must contain a field name, optionally
* followed by a column name. The column can be "entity" for reference
* fields and that can be followed similarly by a field name and so on. Some
* examples:
* followed by a column name. The column can be the reference property,
* usually "entity", for reference fields and that can be followed
* similarly by a field name and so on. Additionally, the target entity type
* can be specified by appending the ":target_entity_type_id" to "entity".
* Some examples:
* - nid
* - tags.value
* - tags
* - tags.entity.name
* - tags.entity:taxonomy_term.name
* - uid.entity.name
* - uid.entity:user.name
* "tags" "is the same as "tags.value" as value is the default column.
* If two or more conditions have the same field names they apply to the
* same delta within that field. In order to limit the condition to a

View file

@ -6,6 +6,8 @@ use Drupal\Core\Database\Query\SelectInterface;
use Drupal\Core\Entity\Query\QueryException;
use Drupal\Core\Entity\Sql\SqlEntityStorageInterface;
use Drupal\Core\Entity\Sql\TableMappingInterface;
use Drupal\Core\Entity\TypedData\EntityDataDefinitionInterface;
use Drupal\Core\TypedData\DataReferenceDefinitionInterface;
/**
* Adds tables and fields to the SQL entity query.
@ -253,10 +255,20 @@ class Tables implements TablesInterface {
$relationship_specifier = $specifiers[$key + 1];
$next_index_prefix = $relationship_specifier;
}
$entity_type_id = NULL;
// Relationship specifier can also contain the entity type ID, i.e.
// entity:node, entity:user or entity:taxonomy.
if (strpos($relationship_specifier, ':') !== FALSE) {
list($relationship_specifier, $entity_type_id) = explode(':', $relationship_specifier, 2);
}
// Check for a valid relationship.
if (isset($propertyDefinitions[$relationship_specifier]) && $field_storage->getPropertyDefinition('entity')->getDataType() == 'entity_reference' ) {
// If it is, use the entity type.
$entity_type_id = $propertyDefinitions[$relationship_specifier]->getTargetDefinition()->getEntityTypeId();
if (isset($propertyDefinitions[$relationship_specifier]) && $propertyDefinitions[$relationship_specifier] instanceof DataReferenceDefinitionInterface) {
// If it is, use the entity type if specified already, otherwise use
// the definition.
$target_definition = $propertyDefinitions[$relationship_specifier]->getTargetDefinition();
if (!$entity_type_id && $target_definition instanceof EntityDataDefinitionInterface) {
$entity_type_id = $target_definition->getEntityTypeId();
}
$entity_type = $this->entityManager->getDefinition($entity_type_id);
$field_storage_definitions = $this->entityManager->getFieldStorageDefinitions($entity_type_id);
// Add the new entity base table using the table and sql column.

View file

@ -1257,7 +1257,11 @@ class SqlContentEntityStorage extends ContentEntityStorageBase implements SqlEnt
foreach ($storage_definition->getColumns() as $column => $attributes) {
$column_name = $table_mapping->getFieldColumnName($storage_definition, $column);
// Serialize the value if specified in the column schema.
$record[$column_name] = !empty($attributes['serialize']) ? serialize($item->$column) : $item->$column;
$value = $item->$column;
if (!empty($attributes['serialize'])) {
$value = serialize($value);
}
$record[$column_name] = drupal_schema_get_field_value($attributes, $value);
}
$query->values($record);
if ($this->entityType->isRevisionable()) {

View file

@ -168,6 +168,10 @@ class EntityReferenceEntityFormatter extends EntityReferenceFormatterBase implem
$recursive_render_id = $items->getFieldDefinition()->getTargetEntityTypeId()
. $items->getFieldDefinition()->getTargetBundle()
. $items->getName()
// We include the referencing entity, so we can render default images
// without hitting recursive protections.
. $items->getEntity()->id()
. $entity->getEntityTypeId()
. $entity->id();
if (isset(static::$recursiveRenderDepth[$recursive_render_id])) {

View file

@ -3,6 +3,7 @@
namespace Drupal\Core\Field\Plugin\Field\FieldType;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
/**
* Defines the 'uuid' entity field type.
@ -48,4 +49,12 @@ class UuidItem extends StringItem {
return $schema;
}
/**
* {@inheritdoc}
*/
public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
$values['value'] = \Drupal::service('uuid')->generate();
return $values;
}
}

View file

@ -36,7 +36,7 @@ abstract class WidgetBase extends PluginSettingsBase implements WidgetInterface
/**
* Constructs a WidgetBase object.
*
* @param array $plugin_id
* @param string $plugin_id
* The plugin_id for the widget.
* @param mixed $plugin_definition
* The plugin implementation definition.

View file

@ -318,7 +318,7 @@ class LanguageManager implements LanguageManagerInterface {
'th' => array('Thai', 'ภาษาไทย'),
'tr' => array('Turkish', 'Türkçe'),
'tyv' => array('Tuvan', 'Тыва дыл'),
'ug' => array('Uyghur', 'Уйғур'),
'ug' => array('Uyghur', /* Left-to-right marker "" */ 'ئۇيغۇرچە', LanguageInterface::DIRECTION_RTL),
'uk' => array('Ukrainian', 'Українська'),
'ur' => array('Urdu', /* Left-to-right marker "" */ 'اردو', LanguageInterface::DIRECTION_RTL),
'vi' => array('Vietnamese', 'Tiếng Việt'),

View file

@ -2,6 +2,7 @@
namespace Drupal\Core\Plugin\Context;
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
use Drupal\Core\TypedData\TypedDataTrait;
/**
@ -9,6 +10,8 @@ use Drupal\Core\TypedData\TypedDataTrait;
*/
class ContextDefinition implements ContextDefinitionInterface {
use DependencySerializationTrait;
use TypedDataTrait;
/**

View file

@ -419,9 +419,13 @@ class HtmlResponseAttachmentsProcessor implements AttachmentsResponseProcessorIn
if ($should_add_header) {
// Also add a HTTP header "Link:".
$href = '<' . Html::escape($attributes['href'] . '>');
$href = '<' . Html::escape($attributes['href']) . '>';
unset($attributes['href']);
$attached['http_header'][] = ['Link', $href . drupal_http_header_attributes($attributes), TRUE];
if ($param = drupal_http_header_attributes($attributes)) {
$href .= ';' . $param;
}
$attached['http_header'][] = ['Link', $href, FALSE];
}
}
return $attached;

View file

@ -3,6 +3,7 @@
namespace Drupal\Core\StringTranslation\Translator;
use Drupal\Core\Site\Settings;
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
/**
* String translator using overrides from variables.
@ -12,6 +13,8 @@ use Drupal\Core\Site\Settings;
*/
class CustomStrings extends StaticTranslation {
use DependencySerializationTrait;
/**
* The settings read only object.
*