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

This commit is contained in:
Pantheon Automation 2016-08-03 13:22:33 -07:00 committed by Greg Anderson
parent e9f047ccf8
commit f9f23cdf38
312 changed files with 6751 additions and 1546 deletions

View file

@ -1032,6 +1032,11 @@ abstract class ContentEntityBase extends Entity implements \IteratorAggregate, C
$this->clearTranslationCache();
$translations = $this->translations;
$this->translations = &$translations;
// Ensure the enforceIsNew property is actually cloned by overwriting the
// original reference with one pointing to a copy of it.
$enforce_is_new = $this->enforceIsNew;
$this->enforceIsNew = &$enforce_is_new;
}
}

View file

@ -222,7 +222,9 @@ abstract class Entity implements EntityInterface {
->setOption('entity', $this);
// Display links by default based on the current language.
if ($rel !== 'collection') {
// Link relations that do not require an existing entity should not be
// affected by this entity's language, however.
if (!in_array($rel, ['collection', 'add-page', 'add-form'], TRUE)) {
$options += ['language' => $this->language()];
}
@ -302,10 +304,14 @@ abstract class Entity implements EntityInterface {
protected function urlRouteParameters($rel) {
$uri_route_parameters = [];
if ($rel != 'collection') {
if (!in_array($rel, ['collection', 'add-page', 'add-form'], TRUE)) {
// The entity ID is needed as a route parameter.
$uri_route_parameters[$this->getEntityTypeId()] = $this->id();
}
if ($rel === 'add-form' && ($this->getEntityType()->hasKey('bundle'))) {
$parameter_name = $this->getEntityType()->getBundleEntityType() ?: $this->getEntityType()->getKey('bundle');
$uri_route_parameters[$parameter_name] = $this->bundle();
}
if ($rel === 'revision' && $this instanceof RevisionableInterface) {
$uri_route_parameters[$this->getEntityTypeId() . '_revision'] = $this->getRevisionId();
}

View file

@ -277,7 +277,7 @@ class EntityViewDisplay extends EntityDisplayBase implements EntityViewDisplayIn
'view_mode' => $this->originalMode,
'display' => $this,
);
\Drupal::moduleHandler()->alter('entity_display_build', $build_list[$key], $context);
\Drupal::moduleHandler()->alter('entity_display_build', $build_list[$id], $context);
}
return $build_list;

View file

@ -172,7 +172,7 @@ class EntityResolverManager {
// First try to figure out whether there is already a parameter upcasting
// the same entity type already.
foreach ($parameter_definitions as $info) {
if (isset($info['type'])) {
if (isset($info['type']) && (strpos($info['type'], 'entity:') === 0)) {
// The parameter types are in the form 'entity:$entity_type'.
list(, $parameter_entity_type) = explode(':', $info['type'], 2);
if ($parameter_entity_type == $entity_type) {

View file

@ -515,15 +515,29 @@ class SqlContentEntityStorage extends ContentEntityStorageBase implements SqlEnt
// Find revisioned fields that are not entity keys. Exclude the langcode
// key as the base table holds only the default language.
$base_fields = array_diff($table_mapping->getFieldNames($this->baseTable), array($this->langcodeKey));
$fields = array_diff($table_mapping->getFieldNames($this->revisionDataTable), $base_fields);
$revisioned_fields = array_diff($table_mapping->getFieldNames($this->revisionDataTable), $base_fields);
// Find fields that are not revisioned or entity keys. Data fields have
// the same value regardless of entity revision.
$data_fields = array_diff($table_mapping->getFieldNames($this->dataTable), $fields, $base_fields);
$data_fields = array_diff($table_mapping->getFieldNames($this->dataTable), $revisioned_fields, $base_fields);
// If there are no data fields then only revisioned fields are needed
// else both data fields and revisioned fields are needed to map the
// entity values.
$all_fields = $revisioned_fields;
if ($data_fields) {
$fields = array_merge($fields, $data_fields);
$all_fields = array_merge($revisioned_fields, $data_fields);
$query->leftJoin($this->dataTable, 'data', "(revision.$this->idKey = data.$this->idKey)");
$query->fields('data', $data_fields);
$column_names = [];
// Some fields can have more then one columns in the data table so
// column names are needed.
foreach ($data_fields as $data_field) {
// \Drupal\Core\Entity\Sql\TableMappingInterface:: getColumNames()
// returns an array keyed by property names so remove the keys
// before array_merge() to avoid losing data with fields having the
// same columns i.e. value.
$column_names = array_merge($column_names, array_values($table_mapping->getColumnNames($data_field)));
}
$query->fields('data', $column_names);
}
// Get the revision IDs.
@ -534,7 +548,7 @@ class SqlContentEntityStorage extends ContentEntityStorageBase implements SqlEnt
$query->condition('revision.' . $this->revisionKey, $revision_ids, 'IN');
}
else {
$fields = $table_mapping->getFieldNames($this->dataTable);
$all_fields = $table_mapping->getFieldNames($this->dataTable);
}
$result = $query->execute();
@ -547,7 +561,7 @@ class SqlContentEntityStorage extends ContentEntityStorageBase implements SqlEnt
$translations[$id][$langcode] = TRUE;
foreach ($fields as $field_name) {
foreach ($all_fields as $field_name) {
$columns = $table_mapping->getColumnNames($field_name);
// Do not key single-column fields by property name.
if (count($columns) == 1) {

View file

@ -45,7 +45,11 @@ interface TableMappingInterface {
public function getAllColumns($table_name);
/**
* Gets a list of names of fields stored in the specified table.
* Gets a list of names for entity fields stored in the specified table.
*
* The return list is contains the entity field names, not database field
* (i.e. column) names. To get the mapping of specific entity field to
* database columns use ::getColumnNames().
*
* @param string $table_name
* The name of the table to return the field names for.

View file

@ -717,7 +717,7 @@ function hook_entity_view_mode_info_alter(&$view_modes) {
* - translatable: (optional) A boolean value specifying whether this bundle
* has translation support enabled. Defaults to FALSE.
*
* @see entity_get_bundles()
* @see \Drupal\Core\Entity\EntityTypeBundleInfo::getBundleInfo()
* @see hook_entity_bundle_info_alter()
*/
function hook_entity_bundle_info() {
@ -731,7 +731,7 @@ function hook_entity_bundle_info() {
* @param array $bundles
* An array of bundles, keyed first by entity type, then by bundle name.
*
* @see entity_get_bundles()
* @see Drupal\Core\Entity\EntityTypeBundleInfo::getBundleInfo()
* @see hook_entity_bundle_info()
*/
function hook_entity_bundle_info_alter(&$bundles) {