diff --git a/composer.lock b/composer.lock
index 19ee071..63573e0 100644
--- a/composer.lock
+++ b/composer.lock
@@ -2335,16 +2335,16 @@
},
{
"name": "twig/twig",
- "version": "v1.24.0",
+ "version": "v1.23.1",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
- "reference": "3e5aa30ebfbafd5951fb1b01e338e1800ce7e0e8"
+ "reference": "d9b6333ae8dd2c8e3fd256e127548def0bc614c6"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/twigphp/Twig/zipball/3e5aa30ebfbafd5951fb1b01e338e1800ce7e0e8",
- "reference": "3e5aa30ebfbafd5951fb1b01e338e1800ce7e0e8",
+ "url": "https://api.github.com/repos/twigphp/Twig/zipball/d9b6333ae8dd2c8e3fd256e127548def0bc614c6",
+ "reference": "d9b6333ae8dd2c8e3fd256e127548def0bc614c6",
"shasum": ""
},
"require": {
@@ -2357,7 +2357,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.24-dev"
+ "dev-master": "1.23-dev"
}
},
"autoload": {
@@ -2392,7 +2392,7 @@
"keywords": [
"templating"
],
- "time": "2016-01-25 21:22:18"
+ "time": "2015-11-05 12:49:06"
},
{
"name": "wikimedia/composer-merge-plugin",
diff --git a/core/core.api.php b/core/core.api.php
index 5fc58ef..a96ca63 100644
--- a/core/core.api.php
+++ b/core/core.api.php
@@ -2095,7 +2095,7 @@ function hook_mail_backend_info_alter(&$info) {
* @param $countries
* The associative array of countries keyed by two-letter country code.
*
- * @see \Drupal\Core\Locale\CountryManager::getList()
+ * @see \Drupal\Core\Locale\CountryManager::getList().
*/
function hook_countries_alter(&$countries) {
// Elbonia is now independent, so add it to the country list.
diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc
index 5052611..8dd191c 100644
--- a/core/includes/install.core.inc
+++ b/core/includes/install.core.inc
@@ -1572,7 +1572,7 @@ function install_download_additional_translations_operations(&$install_state) {
\Drupal::moduleHandler()->loadInclude('locale', 'bulk.inc');
$langcode = $install_state['parameters']['langcode'];
- if (!($language = ConfigurableLanguage::load($langcode))) {
+ if (!($language = entity_load('configurable_language', $langcode))) {
// Create the language if not already shipped with a profile.
$language = ConfigurableLanguage::createFromLangcode($langcode);
}
diff --git a/core/includes/install.inc b/core/includes/install.inc
index 88ca1e2a..31153a4 100644
--- a/core/includes/install.inc
+++ b/core/includes/install.inc
@@ -362,14 +362,13 @@ function drupal_rewrite_settings($settings = array(), $settings_file = NULL) {
* Checks whether this token represents a scalar or NULL.
*
* @param int $type
- * The token type.
+ * The token type
+ * @see token_name().
* @param string $value
* The value of the token.
*
* @return bool
* TRUE if this token represents a scalar or NULL.
- *
- * @see token_name()
*/
function _drupal_rewrite_settings_is_simple($type, $value) {
$is_integer = $type == T_LNUMBER;
@@ -387,12 +386,11 @@ function _drupal_rewrite_settings_is_simple($type, $value) {
* string.
*
* @param int $type
- * The token type.
+ * The token type
+ * @see token_name().
*
* @return bool
* TRUE if this token represents a number or a string.
- *
- * @see token_name()
*/
function _drupal_rewrite_settings_is_array_index($type) {
$is_integer = $type == T_LNUMBER;
diff --git a/core/lib/Drupal/Component/Datetime/DateTimePlus.php b/core/lib/Drupal/Component/Datetime/DateTimePlus.php
index 377bb27..42fa409 100644
--- a/core/lib/Drupal/Component/Datetime/DateTimePlus.php
+++ b/core/lib/Drupal/Component/Datetime/DateTimePlus.php
@@ -104,9 +104,6 @@ class DateTimePlus {
* A DateTime object.
* @param array $settings
* @see __construct()
- *
- * @return static
- * A new DateTimePlus object.
*/
public static function createFromDateTime(\DateTime $datetime, $settings = array()) {
return new static($datetime->format(static::FORMAT), $datetime->getTimezone(), $settings);
@@ -128,10 +125,8 @@ public static function createFromDateTime(\DateTime $datetime, $settings = array
* __construct().
*
* @return static
- * A new DateTimePlus object.
- *
- * @throws \Exception
- * If the array date values or value combination is not correct.
+ * A new \Drupal\Component\DateTimePlus object based on the parameters
+ * passed in.
*/
public static function createFromArray(array $date_parts, $timezone = NULL, $settings = array()) {
$date_parts = static::prepareArray($date_parts, TRUE);
@@ -160,12 +155,6 @@ public static function createFromArray(array $date_parts, $timezone = NULL, $set
* @see __construct()
* @param array $settings
* @see __construct()
- *
- * @return static
- * A new DateTimePlus object.
- *
- * @throws \Exception
- * If the timestamp is not numeric.
*/
public static function createFromTimestamp($timestamp, $timezone = NULL, $settings = array()) {
if (!is_numeric($timestamp)) {
@@ -198,13 +187,6 @@ public static function createFromTimestamp($timestamp, $timezone = NULL, $settin
* from a format string exactly matches the input. This option
* indicates the format can be used for validation. Defaults to TRUE.
* @see __construct()
- *
- * @return static
- * A new DateTimePlus object.
- *
- * @throws \Exception
- * If the a date cannot be created from the given format, or if the
- * created date does not match the input value.
*/
public static function createFromFormat($format, $time, $timezone = NULL, $settings = array()) {
if (!isset($settings['validate_format'])) {
@@ -366,9 +348,6 @@ public function __clone() {
* @param mixed $time
* An input value, which could be a timestamp, a string,
* or an array of date parts.
- *
- * @return mixed
- * The massaged time.
*/
protected function prepareTime($time) {
return $time;
@@ -383,9 +362,6 @@ protected function prepareTime($time) {
*
* @param mixed $timezone
* Either a timezone name or a timezone object or NULL.
- *
- * @return \DateTimeZone
- * The massaged time zone.
*/
protected function prepareTimezone($timezone) {
// If the input timezone is a valid timezone object, use it.
@@ -418,9 +394,6 @@ protected function prepareTimezone($timezone) {
*
* @param string $format
* A PHP format string.
- *
- * @return string
- * The massaged PHP format string.
*/
protected function prepareFormat($format) {
return $format;
@@ -454,10 +427,6 @@ public function checkErrors() {
/**
* Detects if there were errors in the processing of this date.
- *
- * @return boolean
- * TRUE if there were errors in the processing of this date, FALSE
- * otherwise.
*/
public function hasErrors() {
return (boolean) count($this->errors);
@@ -467,9 +436,6 @@ public function hasErrors() {
* Gets error messages.
*
* Public function to return the error messages.
- *
- * @return array
- * An array of errors encountered when creating this date.
*/
public function getErrors() {
return $this->errors;
diff --git a/core/lib/Drupal/Component/Plugin/Exception/InvalidPluginDefinitionException.php b/core/lib/Drupal/Component/Plugin/Exception/InvalidPluginDefinitionException.php
index c958260..220ba03 100644
--- a/core/lib/Drupal/Component/Plugin/Exception/InvalidPluginDefinitionException.php
+++ b/core/lib/Drupal/Component/Plugin/Exception/InvalidPluginDefinitionException.php
@@ -17,12 +17,10 @@ class InvalidPluginDefinitionException extends PluginException {
/**
* Constructs a InvalidPluginDefinitionException.
*
- * For the remaining parameters see \Exception.
- *
* @param string $plugin_id
* The plugin ID of the mapper.
*
- * @see \Exception
+ * @see \Exception for the remaining parameters.
*/
public function __construct($plugin_id, $message = '', $code = 0, \Exception $previous = NULL) {
$this->pluginId = $plugin_id;
diff --git a/core/lib/Drupal/Component/Plugin/Exception/PluginNotFoundException.php b/core/lib/Drupal/Component/Plugin/Exception/PluginNotFoundException.php
index fa83e01..1d2c92f 100644
--- a/core/lib/Drupal/Component/Plugin/Exception/PluginNotFoundException.php
+++ b/core/lib/Drupal/Component/Plugin/Exception/PluginNotFoundException.php
@@ -10,12 +10,10 @@ class PluginNotFoundException extends PluginException {
/**
* Construct an PluginNotFoundException exception.
*
- * For the remaining parameters see \Exception.
- *
* @param string $plugin_id
* The plugin ID that was not found.
*
- * @see \Exception
+ * @see \Exception for remaining parameters.
*/
public function __construct($plugin_id, $message = '', $code = 0, \Exception $previous = NULL) {
if (empty($message)) {
diff --git a/core/lib/Drupal/Core/Access/CheckProvider.php b/core/lib/Drupal/Core/Access/CheckProvider.php
index c68cf38..1587419 100644
--- a/core/lib/Drupal/Core/Access/CheckProvider.php
+++ b/core/lib/Drupal/Core/Access/CheckProvider.php
@@ -3,17 +3,14 @@
namespace Drupal\Core\Access;
use Drupal\Core\Routing\Access\AccessInterface;
-use Symfony\Component\DependencyInjection\ContainerAwareInterface;
-use Symfony\Component\DependencyInjection\ContainerAwareTrait;
+use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
/**
* Loads access checkers from the container.
*/
-class CheckProvider implements CheckProviderInterface, ContainerAwareInterface {
-
- use ContainerAwareTrait;
+class CheckProvider extends ContainerAware implements CheckProviderInterface {
/**
* Array of registered access check service ids.
diff --git a/core/lib/Drupal/Core/Cache/Context/LanguagesCacheContext.php b/core/lib/Drupal/Core/Cache/Context/LanguagesCacheContext.php
index a13b763..eb7ce68 100644
--- a/core/lib/Drupal/Core/Cache/Context/LanguagesCacheContext.php
+++ b/core/lib/Drupal/Core/Cache/Context/LanguagesCacheContext.php
@@ -8,7 +8,7 @@
/**
* Defines the LanguagesCacheContext service, for "per language" caching.
*/
-class LanguagesCacheContext implements CalculatedCacheContextInterface {
+class LanguagesCacheContext implements CalculatedCacheContextInterface {
/**
* The language manager.
diff --git a/core/lib/Drupal/Core/Cache/Context/MenuActiveTrailsCacheContext.php b/core/lib/Drupal/Core/Cache/Context/MenuActiveTrailsCacheContext.php
index db31384..67a40a6 100644
--- a/core/lib/Drupal/Core/Cache/Context/MenuActiveTrailsCacheContext.php
+++ b/core/lib/Drupal/Core/Cache/Context/MenuActiveTrailsCacheContext.php
@@ -3,8 +3,7 @@
namespace Drupal\Core\Cache\Context;
use Drupal\Core\Cache\CacheableMetadata;
-use Symfony\Component\DependencyInjection\ContainerAwareInterface;
-use Symfony\Component\DependencyInjection\ContainerAwareTrait;
+use Symfony\Component\DependencyInjection\ContainerAware;
/**
* Defines the MenuActiveTrailsCacheContext service.
@@ -12,9 +11,7 @@
* This class is container-aware to avoid initializing the 'menu.active_trails'
* service (and its dependencies) when it is not necessary.
*/
-class MenuActiveTrailsCacheContext implements CalculatedCacheContextInterface, ContainerAwareInterface {
-
- use ContainerAwareTrait;
+class MenuActiveTrailsCacheContext extends ContainerAware implements CalculatedCacheContextInterface {
/**
* {@inheritdoc}
diff --git a/core/lib/Drupal/Core/Config/ConfigCollectionInfo.php b/core/lib/Drupal/Core/Config/ConfigCollectionInfo.php
index ca526cd..7132145 100644
--- a/core/lib/Drupal/Core/Config/ConfigCollectionInfo.php
+++ b/core/lib/Drupal/Core/Config/ConfigCollectionInfo.php
@@ -30,7 +30,7 @@ class ConfigCollectionInfo extends Event {
*
* @throws \InvalidArgumentException
* Exception thrown if $collection is equal to
- * \Drupal\Core\Config\StorageInterface::DEFAULT_COLLECTION.
+ * \Drupal\Core\Config\StorageInterface::DEFAULT_COLLECTION
*/
public function addCollection($collection, ConfigFactoryOverrideInterface $override_service = NULL) {
if ($collection == StorageInterface::DEFAULT_COLLECTION) {
diff --git a/core/lib/Drupal/Core/Config/DatabaseStorage.php b/core/lib/Drupal/Core/Config/DatabaseStorage.php
index 4e0c184..930eea1 100644
--- a/core/lib/Drupal/Core/Config/DatabaseStorage.php
+++ b/core/lib/Drupal/Core/Config/DatabaseStorage.php
@@ -252,8 +252,7 @@ public function encode($data) {
* Implements Drupal\Core\Config\StorageInterface::decode().
*
* @throws ErrorException
- * The unserialize() call will trigger E_NOTICE if the string cannot
- * be unserialized.
+ * unserialize() triggers E_NOTICE if the string cannot be unserialized.
*/
public function decode($raw) {
$data = @unserialize($raw);
diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php
index 1a36427..688e951 100644
--- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php
+++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php
@@ -127,11 +127,11 @@ public function getConfigDependencyKey() {
/**
* {@inheritdoc}
*
+ * @see \Drupal\Core\Config\Entity\ConfigEntityStorage.
+ *
* @throws \Drupal\Core\Config\Entity\Exception\ConfigEntityStorageClassException
* Exception thrown when the provided class is not an instance of
* \Drupal\Core\Config\Entity\ConfigEntityStorage.
- *
- * @see \Drupal\Core\Config\Entity\ConfigEntityStorage
*/
protected function checkStorageClass($class) {
if (!is_a($class, 'Drupal\Core\Config\Entity\ConfigEntityStorage', TRUE)) {
diff --git a/core/lib/Drupal/Core/Config/StorageComparerInterface.php b/core/lib/Drupal/Core/Config/StorageComparerInterface.php
index 803e092..6f6efce 100644
--- a/core/lib/Drupal/Core/Config/StorageComparerInterface.php
+++ b/core/lib/Drupal/Core/Config/StorageComparerInterface.php
@@ -67,10 +67,10 @@ public function reset();
*
* Until the changelist has been calculated this will always be FALSE.
*
+ * @see \Drupal\Core\Config\StorageComparerInterface::createChangelist().
+ *
* @return bool
* TRUE if there are changes to process and FALSE if not.
- *
- * @see \Drupal\Core\Config\StorageComparerInterface::createChangelist()
*/
public function hasChanges();
diff --git a/core/lib/Drupal/Core/CoreServiceProvider.php b/core/lib/Drupal/Core/CoreServiceProvider.php
index 9117891..51b1c51 100644
--- a/core/lib/Drupal/Core/CoreServiceProvider.php
+++ b/core/lib/Drupal/Core/CoreServiceProvider.php
@@ -40,7 +40,7 @@
*
* @ingroup container
*/
-class CoreServiceProvider implements ServiceProviderInterface, ServiceModifierInterface {
+class CoreServiceProvider implements ServiceProviderInterface, ServiceModifierInterface {
/**
* {@inheritdoc}
diff --git a/core/lib/Drupal/Core/Cron.php b/core/lib/Drupal/Core/Cron.php
index 9927043..533ae48 100644
--- a/core/lib/Drupal/Core/Cron.php
+++ b/core/lib/Drupal/Core/Cron.php
@@ -223,12 +223,6 @@ protected function invokeCronHandlers() {
Timer::stop('cron_' . $module);
$module_previous = $module;
}
- if ($module_previous) {
- $this->logger->notice('Execution of @module_previous_cron() took @time.', [
- '@module_previous' => $module_previous,
- '@time' => Timer::read('cron_' . $module_previous) . 'ms',
- ]);
- }
}
}
diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php
index 4688cde..ef54471 100644
--- a/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php
+++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php
@@ -374,7 +374,7 @@ public function getFullQualifiedTableName($table) {
* A string representing the savepoint name. By default,
* "mimic_implicit_commit" is used.
*
- * @see Drupal\Core\Database\Connection::pushTransaction()
+ * @see Drupal\Core\Database\Connection::pushTransaction().
*/
public function addSavepoint($savepoint_name = 'mimic_implicit_commit') {
if ($this->inTransaction()) {
@@ -389,7 +389,7 @@ public function addSavepoint($savepoint_name = 'mimic_implicit_commit') {
* A string representing the savepoint name. By default,
* "mimic_implicit_commit" is used.
*
- * @see Drupal\Core\Database\Connection::popTransaction()
+ * @see Drupal\Core\Database\Connection::popTransaction().
*/
public function releaseSavepoint($savepoint_name = 'mimic_implicit_commit') {
if (isset($this->transactionLayers[$savepoint_name])) {
diff --git a/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php b/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php
index c0a8747..1fb810b 100644
--- a/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php
+++ b/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php
@@ -125,8 +125,7 @@ private function parseDefinitions($content, $file)
* @param array $service
* @param string $file
*
- * @throws InvalidArgumentException
- * When tags are invalid.
+ * @throws InvalidArgumentException When tags are invalid
*/
private function parseDefinition($id, $service, $file)
{
@@ -320,8 +319,7 @@ private function parseDefinition($id, $service, $file)
*
* @return array The file content
*
- * @throws InvalidArgumentException
- * When the given file is not a local file or when it does not exist.
+ * @throws InvalidArgumentException when the given file is not a local file or when it does not exist
*/
protected function loadFile($file)
{
@@ -344,8 +342,7 @@ protected function loadFile($file)
*
* @return array
*
- * @throws InvalidArgumentException
- * When service file is not valid.
+ * @throws InvalidArgumentException When service file is not valid
*/
private function validate($content, $file)
{
diff --git a/core/lib/Drupal/Core/Entity/ContentEntityType.php b/core/lib/Drupal/Core/Entity/ContentEntityType.php
index 6d8d619..c482ea6 100644
--- a/core/lib/Drupal/Core/Entity/ContentEntityType.php
+++ b/core/lib/Drupal/Core/Entity/ContentEntityType.php
@@ -28,11 +28,11 @@ public function getConfigDependencyKey() {
/**
* {@inheritdoc}
*
+ * @see \Drupal\Core\Entity\ContentEntityStorageInterface.
+ *
* @throws \InvalidArgumentException
* If the provided class does not implement
* \Drupal\Core\Entity\ContentEntityStorageInterface.
- *
- * @see \Drupal\Core\Entity\ContentEntityStorageInterface
*/
protected function checkStorageClass($class) {
$required_interface = ContentEntityStorageInterface::class;
diff --git a/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php
index 23fd0b5..3e17e80 100644
--- a/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php
+++ b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php
@@ -57,33 +57,19 @@ public static function valueCallback(&$element, $input, FormStateInterface $form
if (is_array($element['#default_value']) && $element['#tags'] !== TRUE) {
throw new \InvalidArgumentException('The #default_value property is an array but the form element does not allow multiple values.');
}
- elseif (!empty($element['#default_value']) && !is_array($element['#default_value'])) {
+ elseif (!is_array($element['#default_value'])) {
// Convert the default value into an array for easier processing in
// static::getEntityLabels().
$element['#default_value'] = array($element['#default_value']);
}
- if ($element['#default_value']) {
- if (!(reset($element['#default_value']) instanceof EntityInterface)) {
- throw new \InvalidArgumentException('The #default_value property has to be an entity object or an array of entity objects.');
- }
-
- // Extract the labels from the passed-in entity objects, taking access
- // checks into account.
- return static::getEntityLabels($element['#default_value']);
+ if ($element['#default_value'] && !(reset($element['#default_value']) instanceof EntityInterface)) {
+ throw new \InvalidArgumentException('The #default_value property has to be an entity object or an array of entity objects.');
}
- }
- // Potentially the #value is set directly, so it contains the 'target_id'
- // array structure instead of a string.
- if ($input !== FALSE && is_array($input)) {
- $entity_ids = array_map(function(array $item) {
- return $item['target_id'];
- }, $input);
-
- $entities = \Drupal::entityTypeManager()->getStorage($element['#target_type'])->loadMultiple($entity_ids);
-
- return static::getEntityLabels($entities);
+ // Extract the labels from the passed-in entity objects, taking access
+ // checks into account.
+ return static::getEntityLabels($element['#default_value']);
}
}
@@ -150,7 +136,6 @@ public static function processEntityAutocomplete(array &$element, FormStateInter
*/
public static function validateEntityAutocomplete(array &$element, FormStateInterface $form_state, array &$complete_form) {
$value = NULL;
-
if (!empty($element['#value'])) {
$options = array(
'target_type' => $element['#target_type'],
@@ -161,35 +146,27 @@ public static function validateEntityAutocomplete(array &$element, FormStateInte
$handler = \Drupal::service('plugin.manager.entity_reference_selection')->getInstance($options);
$autocreate = (bool) $element['#autocreate'] && $handler instanceof SelectionWithAutocreateInterface;
- // GET forms might pass the validated data around on the next request, in
- // which case it will already be in the expected format.
- if (is_array($element['#value'])) {
- $value = $element['#value'];
- }
- else {
- $input_values = $element['#tags'] ? Tags::explode($element['#value']) : array($element['#value']);
-
- foreach ($input_values as $input) {
- $match = static::extractEntityIdFromAutocompleteInput($input);
- if ($match === NULL) {
- // Try to get a match from the input string when the user didn't use
- // the autocomplete but filled in a value manually.
- $match = static::matchEntityByTitle($handler, $input, $element, $form_state, !$autocreate);
- }
+ $input_values = $element['#tags'] ? Tags::explode($element['#value']) : array($element['#value']);
+ foreach ($input_values as $input) {
+ $match = static::extractEntityIdFromAutocompleteInput($input);
+ if ($match === NULL) {
+ // Try to get a match from the input string when the user didn't use
+ // the autocomplete but filled in a value manually.
+ $match = static::matchEntityByTitle($handler, $input, $element, $form_state, !$autocreate);
+ }
- if ($match !== NULL) {
- $value[] = array(
- 'target_id' => $match,
- );
- }
- elseif ($autocreate) {
- /** @var \Drupal\Core\Entity\EntityReferenceSelection\SelectionWithAutocreateInterface $handler */
- // Auto-create item. See an example of how this is handled in
- // \Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::presave().
- $value[] = array(
- 'entity' => $handler->createNewEntity($element['#target_type'], $element['#autocreate']['bundle'], $input, $element['#autocreate']['uid']),
- );
- }
+ if ($match !== NULL) {
+ $value[] = array(
+ 'target_id' => $match,
+ );
+ }
+ elseif ($autocreate) {
+ /** @var \Drupal\Core\Entity\EntityReferenceSelection\SelectionWithAutocreateInterface $handler */
+ // Auto-create item. See an example of how this is handled in
+ // \Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::presave().
+ $value[] = array(
+ 'entity' => $handler->createNewEntity($element['#target_type'], $element['#autocreate']['bundle'], $input, $element['#autocreate']['uid']),
+ );
}
}
diff --git a/core/lib/Drupal/Core/Entity/Query/QueryAggregateInterface.php b/core/lib/Drupal/Core/Entity/Query/QueryAggregateInterface.php
index 76c644d..dafa674 100644
--- a/core/lib/Drupal/Core/Entity/Query/QueryAggregateInterface.php
+++ b/core/lib/Drupal/Core/Entity/Query/QueryAggregateInterface.php
@@ -63,7 +63,7 @@ public function groupBy($field);
* @return \Drupal\Core\Entity\Query\QueryAggregateInterface
* The called object.
*
- * @see \Drupal\Core\Entity\Query\QueryInterface::condition()
+ * @see \Drupal\Core\Entity\Query\QueryInterface::condition().
*/
public function conditionAggregate($field, $function = NULL, $value = NULL, $operator = '=', $langcode = NULL);
diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
index d584454..72c7458 100644
--- a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
+++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
@@ -36,7 +36,7 @@
*
* @ingroup entity_api
*/
-class SqlContentEntityStorage extends ContentEntityStorageBase implements SqlEntityStorageInterface, DynamicallyFieldableEntityStorageSchemaInterface, EntityBundleListenerInterface {
+class SqlContentEntityStorage extends ContentEntityStorageBase implements SqlEntityStorageInterface, DynamicallyFieldableEntityStorageSchemaInterface, EntityBundleListenerInterface {
/**
* The mapping of field columns to SQL tables.
diff --git a/core/lib/Drupal/Core/Extension/InfoParserInterface.php b/core/lib/Drupal/Core/Extension/InfoParserInterface.php
index 468a94a..e5c99fe 100644
--- a/core/lib/Drupal/Core/Extension/InfoParserInterface.php
+++ b/core/lib/Drupal/Core/Extension/InfoParserInterface.php
@@ -5,7 +5,7 @@
/**
* Interface for classes that parses Drupal's info.yml files.
*/
-interface InfoParserInterface {
+interface InfoParserInterface {
/**
* Parses Drupal module, theme and profile .info.yml files.
diff --git a/core/lib/Drupal/Core/Extension/ThemeHandlerInterface.php b/core/lib/Drupal/Core/Extension/ThemeHandlerInterface.php
index 33ad502..3b89047 100644
--- a/core/lib/Drupal/Core/Extension/ThemeHandlerInterface.php
+++ b/core/lib/Drupal/Core/Extension/ThemeHandlerInterface.php
@@ -21,7 +21,7 @@
* Whether any of the given themes have been installed.
*
* @throws \Drupal\Core\Extension\ExtensionNameLengthException
- * Thrown when the theme name is to long.
+ * Thrown when the theme name is to long
*
* @deprecated in Drupal 8.0.x-dev and will be removed before Drupal 9.0.0.
* Use the theme_installer service instead.
diff --git a/core/lib/Drupal/Core/Extension/ThemeInstallerInterface.php b/core/lib/Drupal/Core/Extension/ThemeInstallerInterface.php
index ad80762..3e5096f 100644
--- a/core/lib/Drupal/Core/Extension/ThemeInstallerInterface.php
+++ b/core/lib/Drupal/Core/Extension/ThemeInstallerInterface.php
@@ -21,7 +21,7 @@
* Whether any of the given themes have been installed.
*
* @throws \Drupal\Core\Extension\ExtensionNameLengthException
- * Thrown when the theme name is to long.
+ * Thrown when the theme name is to long
*/
public function install(array $theme_list, $install_dependencies = TRUE);
diff --git a/core/lib/Drupal/Core/Extension/module.api.php b/core/lib/Drupal/Core/Extension/module.api.php
index 37f8b77..7f65fea 100644
--- a/core/lib/Drupal/Core/Extension/module.api.php
+++ b/core/lib/Drupal/Core/Extension/module.api.php
@@ -81,7 +81,7 @@
*
* See system_hook_info() for all hook groups defined by Drupal core.
*
- * @see hook_hook_info_alter()
+ * @see hook_hook_info_alter().
*/
function hook_hook_info() {
$hooks['token_info'] = array(
diff --git a/core/lib/Drupal/Core/Field/FieldItemInterface.php b/core/lib/Drupal/Core/Field/FieldItemInterface.php
index a257dd0..14cf9e9 100644
--- a/core/lib/Drupal/Core/Field/FieldItemInterface.php
+++ b/core/lib/Drupal/Core/Field/FieldItemInterface.php
@@ -98,7 +98,7 @@ public function getEntity();
/**
* Gets the langcode of the field values held in the object.
*
- * @return string
+ * @return $langcode
* The langcode.
*/
public function getLangcode();
diff --git a/core/lib/Drupal/Core/Field/FieldItemListInterface.php b/core/lib/Drupal/Core/Field/FieldItemListInterface.php
index 2266c9c..e8bba02 100644
--- a/core/lib/Drupal/Core/Field/FieldItemListInterface.php
+++ b/core/lib/Drupal/Core/Field/FieldItemListInterface.php
@@ -44,7 +44,7 @@ public function setLangcode($langcode);
/**
* Gets the langcode of the field values held in the object.
*
- * @return string
+ * @return $langcode
* The langcode.
*/
public function getLangcode();
diff --git a/core/lib/Drupal/Core/Installer/InstallerKernel.php b/core/lib/Drupal/Core/Installer/InstallerKernel.php
index e00c215..c975715 100644
--- a/core/lib/Drupal/Core/Installer/InstallerKernel.php
+++ b/core/lib/Drupal/Core/Installer/InstallerKernel.php
@@ -27,7 +27,7 @@ protected function initializeContainer() {
* re-instantiated during a single install request. Most drivers will not
* need this method.
*
- * @see \Drupal\Core\Database\Install\Tasks::runTasks()
+ * @see \Drupal\Core\Database\Install\Tasks::runTasks().
*/
public function resetConfigStorage() {
$this->configStorage = NULL;
diff --git a/core/lib/Drupal/Core/Render/Element/Pager.php b/core/lib/Drupal/Core/Render/Element/Pager.php
index 6ba3dff..7032b52 100644
--- a/core/lib/Drupal/Core/Render/Element/Pager.php
+++ b/core/lib/Drupal/Core/Render/Element/Pager.php
@@ -30,7 +30,7 @@
*
* @RenderElement("pager")
*/
-class Pager extends RenderElement {
+class Pager extends RenderElement{
/**
* {@inheritdoc}
diff --git a/core/lib/Drupal/Core/Render/MainContent/MainContentRendererInterface.php b/core/lib/Drupal/Core/Render/MainContent/MainContentRendererInterface.php
index aa8b60c..d78c56a 100644
--- a/core/lib/Drupal/Core/Render/MainContent/MainContentRendererInterface.php
+++ b/core/lib/Drupal/Core/Render/MainContent/MainContentRendererInterface.php
@@ -13,7 +13,7 @@
* (HTML, JSON …) and/or in a certain decorated manner (e.g. in the case of the
* default HTML main content renderer: with a page display variant applied).
*/
-interface MainContentRendererInterface {
+interface MainContentRendererInterface {
/**
* Renders the main content render array into a response.
diff --git a/core/lib/Drupal/Core/Render/RendererInterface.php b/core/lib/Drupal/Core/Render/RendererInterface.php
index 5f8802d..a7516b4 100644
--- a/core/lib/Drupal/Core/Render/RendererInterface.php
+++ b/core/lib/Drupal/Core/Render/RendererInterface.php
@@ -319,8 +319,8 @@ public function renderPlaceholder($placeholder, array $elements);
* The rendered HTML.
*
* @throws \LogicException
- * When called outside of a render context (i.e. outside of a renderRoot(),
- * renderPlain() or executeInRenderContext() call).
+ * When called outside of a render context. (i.e. outside of a renderRoot(),
+ * renderPlain() or executeInRenderContext() call.)
* @throws \Exception
* If a #pre_render callback throws an exception, it is caught to mark the
* renderer as no longer being in a root render call, if any. Then the
diff --git a/core/lib/Drupal/Core/Routing/LinkGeneratorTrait.php b/core/lib/Drupal/Core/Routing/LinkGeneratorTrait.php
index 06deb1b..f294bee 100644
--- a/core/lib/Drupal/Core/Routing/LinkGeneratorTrait.php
+++ b/core/lib/Drupal/Core/Routing/LinkGeneratorTrait.php
@@ -29,8 +29,8 @@
/**
* Renders a link to a route given a route name and its parameters.
*
- * For details on the arguments, usage, and possible exceptions see
- * \Drupal\Core\Utility\LinkGeneratorInterface::generate().
+ * @see \Drupal\Core\Utility\LinkGeneratorInterface::generate() for details
+ * on the arguments, usage, and possible exceptions.
*
* @return \Drupal\Core\GeneratedLink
* A GeneratedLink object containing a link to the given route and
@@ -38,8 +38,6 @@
*
* @deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0.
* Use \Drupal\Core\Link instead.
- *
- * @see \Drupal\Core\Utility\LinkGeneratorInterface::generate()
*/
protected function l($text, Url $url) {
return $this->getLinkGenerator()->generate($text, $url);
diff --git a/core/lib/Drupal/Core/Routing/UrlGenerator.php b/core/lib/Drupal/Core/Routing/UrlGenerator.php
index 9291c40..71bf332 100644
--- a/core/lib/Drupal/Core/Routing/UrlGenerator.php
+++ b/core/lib/Drupal/Core/Routing/UrlGenerator.php
@@ -157,10 +157,10 @@ public function getPathFromRoute($name, $parameters = array()) {
* The url path, without any base path, including possible query string.
*
* @throws MissingMandatoryParametersException
- * When some parameters are missing that are mandatory for the route.
+ * When some parameters are missing that are mandatory for the route
* @throws InvalidParameterException
* When a parameter value for a placeholder is not correct because it does
- * not match the requirement.
+ * not match the requirement
*/
protected function doGenerate(array $variables, array $defaults, array $tokens, array $parameters, array $query_params, $name) {
$variables = array_flip($variables);
diff --git a/core/lib/Drupal/Core/Routing/UrlGeneratorTrait.php b/core/lib/Drupal/Core/Routing/UrlGeneratorTrait.php
index 98429d4..f092421 100644
--- a/core/lib/Drupal/Core/Routing/UrlGeneratorTrait.php
+++ b/core/lib/Drupal/Core/Routing/UrlGeneratorTrait.php
@@ -27,16 +27,14 @@
/**
* Generates a URL or path for a specific route based on the given parameters.
*
- * For details on the arguments, usage, and possible exceptions see
- * \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute().
+ * @see \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute() for
+ * details on the arguments, usage, and possible exceptions.
*
* @return string
* The generated URL for the given route.
*
* @deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0.
* Use \Drupal\Core\Url instead.
- *
- * @see \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute()
*/
protected function url($route_name, $route_parameters = array(), $options = array()) {
return $this->getUrlGenerator()->generateFromRoute($route_name, $route_parameters, $options);
diff --git a/core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php b/core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php
index 26b8eee..8b9ee4e 100644
--- a/core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php
+++ b/core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php
@@ -2,17 +2,14 @@
namespace Drupal\Core\StreamWrapper;
-use Symfony\Component\DependencyInjection\ContainerAwareInterface;
-use Symfony\Component\DependencyInjection\ContainerAwareTrait;
+use Symfony\Component\DependencyInjection\ContainerAware;
/**
* Provides a StreamWrapper manager.
*
* @see \Drupal\Core\StreamWrapper\StreamWrapperInterface
*/
-class StreamWrapperManager implements ContainerAwareInterface, StreamWrapperManagerInterface {
-
- use ContainerAwareTrait;
+class StreamWrapperManager extends ContainerAware implements StreamWrapperManagerInterface {
/**
* Contains stream wrapper info.
diff --git a/core/lib/Drupal/Core/Template/TwigExtension.php b/core/lib/Drupal/Core/Template/TwigExtension.php
index 38bdc2e..e204ba9 100644
--- a/core/lib/Drupal/Core/Template/TwigExtension.php
+++ b/core/lib/Drupal/Core/Template/TwigExtension.php
@@ -206,11 +206,10 @@ public function getName() {
* @param array $options
* (optional) An associative array of additional options. The 'absolute'
* option is forced to be FALSE.
+ * @see \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute().
*
* @return string
* The generated URL path (relative URL) for the given route.
- *
- * @see \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute()
*/
public function getPath($name, $parameters = array(), $options = array()) {
$options['absolute'] = FALSE;
diff --git a/core/lib/Drupal/Core/Test/TestDatabase.php b/core/lib/Drupal/Core/Test/TestDatabase.php
deleted file mode 100644
index a0121dc..0000000
--- a/core/lib/Drupal/Core/Test/TestDatabase.php
+++ /dev/null
@@ -1,44 +0,0 @@
-uninstall(array('action'));
- $storage = $this->container->get('entity_type.manager')->getStorage('action');
- $storage->resetCache(['user_block_user_action']);
- $this->assertTrue($storage->load('user_block_user_action'), 'Configuration entity \'user_block_user_action\' still exists after uninstalling action module.' );
+ $this->assertTrue(entity_load('action', 'user_block_user_action', TRUE), 'Configuration entity \'user_block_user_action\' still exists after uninstalling action module.' );
$admin_user = $this->drupalCreateUser(array('administer users'));
$this->drupalLogin($admin_user);
diff --git a/core/modules/action/src/Tests/ConfigurationTest.php b/core/modules/action/src/Tests/ConfigurationTest.php
index 225a528..a6b2050 100644
--- a/core/modules/action/src/Tests/ConfigurationTest.php
+++ b/core/modules/action/src/Tests/ConfigurationTest.php
@@ -4,7 +4,6 @@
use Drupal\Component\Utility\Crypt;
use Drupal\simpletest\WebTestBase;
-use Drupal\system\Entity\Action;
/**
* Tests complex actions configuration by adding, editing, and deleting a
@@ -82,7 +81,7 @@ function testActionConfiguration() {
$this->assertResponse(200);
$this->assertNoText($new_action_label, "Make sure the action label does not appear on the overview page after we've deleted the action.");
- $action = Action::load($aid);
+ $action = entity_load('action', $aid);
$this->assertFalse($action, 'Make sure the action is gone after being deleted.');
}
diff --git a/core/modules/aggregator/src/Entity/Feed.php b/core/modules/aggregator/src/Entity/Feed.php
index 834a55e..724a875 100644
--- a/core/modules/aggregator/src/Entity/Feed.php
+++ b/core/modules/aggregator/src/Entity/Feed.php
@@ -127,16 +127,16 @@ public static function postDelete(EntityStorageInterface $storage, array $entiti
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
- /** @var \Drupal\Core\Field\BaseFieldDefinition[] $fields */
- $fields = parent::baseFieldDefinitions($entity_type);
+ $fields['fid'] = BaseFieldDefinition::create('integer')
+ ->setLabel(t('Feed ID'))
+ ->setDescription(t('The ID of the aggregator feed.'))
+ ->setReadOnly(TRUE)
+ ->setSetting('unsigned', TRUE);
- $fields['fid']->setLabel(t('Feed ID'))
- ->setDescription(t('The ID of the aggregator feed.'));
-
- $fields['uuid']->setDescription(t('The aggregator feed UUID.'));
-
- $fields['langcode']->setLabel(t('Language code'))
- ->setDescription(t('The feed language code.'));
+ $fields['uuid'] = BaseFieldDefinition::create('uuid')
+ ->setLabel(t('UUID'))
+ ->setDescription(t('The aggregator feed UUID.'))
+ ->setReadOnly(TRUE);
$fields['title'] = BaseFieldDefinition::create('string')
->setLabel(t('Title'))
@@ -150,6 +150,17 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
->setDisplayConfigurable('form', TRUE)
->addConstraint('FeedTitle');
+ $fields['langcode'] = BaseFieldDefinition::create('language')
+ ->setLabel(t('Language code'))
+ ->setDescription(t('The feed language code.'))
+ ->setDisplayOptions('view', array(
+ 'type' => 'hidden',
+ ))
+ ->setDisplayOptions('form', array(
+ 'type' => 'language_select',
+ 'weight' => 2,
+ ));
+
$fields['url'] = BaseFieldDefinition::create('uri')
->setLabel(t('URL'))
->setDescription(t('The fully-qualified URL of the feed.'))
diff --git a/core/modules/aggregator/src/Entity/Item.php b/core/modules/aggregator/src/Entity/Item.php
index 330aacb..046ec41 100644
--- a/core/modules/aggregator/src/Entity/Item.php
+++ b/core/modules/aggregator/src/Entity/Item.php
@@ -47,14 +47,11 @@ public function label() {
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
- /** @var \Drupal\Core\Field\BaseFieldDefinition[] $fields */
- $fields = parent::baseFieldDefinitions($entity_type);
-
- $fields['iid']->setLabel(t('Aggregator item ID'))
- ->setDescription(t('The ID of the feed item.'));
-
- $fields['langcode']->setLabel(t('Language code'))
- ->setDescription(t('The feed item language code.'));
+ $fields['iid'] = BaseFieldDefinition::create('integer')
+ ->setLabel(t('Aggregator item ID'))
+ ->setDescription(t('The ID of the feed item.'))
+ ->setReadOnly(TRUE)
+ ->setSetting('unsigned', TRUE);
$fields['fid'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Source feed'))
@@ -72,6 +69,10 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
->setLabel(t('Title'))
->setDescription(t('The title of the feed item.'));
+ $fields['langcode'] = BaseFieldDefinition::create('language')
+ ->setLabel(t('Language code'))
+ ->setDescription(t('The feed item language code.'));
+
$fields['link'] = BaseFieldDefinition::create('uri')
->setLabel(t('Link'))
->setDescription(t('The link of the feed item.'))
diff --git a/core/modules/aggregator/src/Form/OpmlFeedAdd.php b/core/modules/aggregator/src/Form/OpmlFeedAdd.php
index 0ba285a..d084bff 100644
--- a/core/modules/aggregator/src/Form/OpmlFeedAdd.php
+++ b/core/modules/aggregator/src/Form/OpmlFeedAdd.php
@@ -99,8 +99,8 @@ public function buildForm(array $form, FormStateInterface $form_state) {
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
// If both fields are empty or filled, cancel.
- $all_files = $this->getRequest()->files->get('files', []);
- if ($form_state->isValueEmpty('remote') == empty($all_files['upload'])) {
+ $file_upload = $this->getRequest()->files->get('files[upload]', NULL, TRUE);
+ if ($form_state->isValueEmpty('remote') == empty($file_upload)) {
$form_state->setErrorByName('remote', $this->t('Either upload a file or enter a URL.'));
}
}
diff --git a/core/modules/block/tests/modules/block_test/src/Controller/TestMultipleFormController.php b/core/modules/block/tests/modules/block_test/src/Controller/TestMultipleFormController.php
index e7aac65..27f7a17 100644
--- a/core/modules/block/tests/modules/block_test/src/Controller/TestMultipleFormController.php
+++ b/core/modules/block/tests/modules/block_test/src/Controller/TestMultipleFormController.php
@@ -8,7 +8,7 @@
/**
* Controller for block_test module
*/
-class TestMultipleFormController extends ControllerBase {
+class TestMultipleFormController extends ControllerBase {
public function testMultipleForms() {
$form_state = new FormState();
diff --git a/core/modules/block_content/src/Entity/BlockContent.php b/core/modules/block_content/src/Entity/BlockContent.php
index e970e07..958fc7a 100644
--- a/core/modules/block_content/src/Entity/BlockContent.php
+++ b/core/modules/block_content/src/Entity/BlockContent.php
@@ -144,20 +144,35 @@ public function delete() {
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
- /** @var \Drupal\Core\Field\BaseFieldDefinition[] $fields */
- $fields = parent::baseFieldDefinitions($entity_type);
-
- $fields['id']->setLabel(t('Custom block ID'))
- ->setDescription(t('The custom block ID.'));
-
- $fields['uuid']->setDescription(t('The custom block UUID.'));
+ $fields['id'] = BaseFieldDefinition::create('integer')
+ ->setLabel(t('Custom block ID'))
+ ->setDescription(t('The custom block ID.'))
+ ->setReadOnly(TRUE)
+ ->setSetting('unsigned', TRUE);
- $fields['revision_id']->setDescription(t('The revision ID.'));
+ $fields['uuid'] = BaseFieldDefinition::create('uuid')
+ ->setLabel(t('UUID'))
+ ->setDescription(t('The custom block UUID.'))
+ ->setReadOnly(TRUE);
- $fields['langcode']->setDescription(t('The custom block language code.'));
+ $fields['revision_id'] = BaseFieldDefinition::create('integer')
+ ->setLabel(t('Revision ID'))
+ ->setDescription(t('The revision ID.'))
+ ->setReadOnly(TRUE)
+ ->setSetting('unsigned', TRUE);
- $fields['type']->setLabel(t('Block type'))
- ->setDescription(t('The block type.'));
+ $fields['langcode'] = BaseFieldDefinition::create('language')
+ ->setLabel(t('Language'))
+ ->setDescription(t('The custom block language code.'))
+ ->setTranslatable(TRUE)
+ ->setRevisionable(TRUE)
+ ->setDisplayOptions('view', array(
+ 'type' => 'hidden',
+ ))
+ ->setDisplayOptions('form', array(
+ 'type' => 'language_select',
+ 'weight' => 2,
+ ));
$fields['info'] = BaseFieldDefinition::create('string')
->setLabel(t('Block description'))
@@ -172,6 +187,12 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
->setDisplayConfigurable('form', TRUE)
->addConstraint('UniqueField', []);
+
+ $fields['type'] = BaseFieldDefinition::create('entity_reference')
+ ->setLabel(t('Block type'))
+ ->setDescription(t('The block type.'))
+ ->setSetting('target_type', 'block_content_type');
+
$fields['revision_log'] = BaseFieldDefinition::create('string_long')
->setLabel(t('Revision log message'))
->setDescription(t('The log entry explaining the changes in this revision.'))
diff --git a/core/modules/book/src/Access/BookNodeIsRemovableAccessCheck.php b/core/modules/book/src/Access/BookNodeIsRemovableAccessCheck.php
index ffe124c..0809e57 100644
--- a/core/modules/book/src/Access/BookNodeIsRemovableAccessCheck.php
+++ b/core/modules/book/src/Access/BookNodeIsRemovableAccessCheck.php
@@ -10,7 +10,7 @@
/**
* Determines whether the requested node can be removed from its book.
*/
-class BookNodeIsRemovableAccessCheck implements AccessInterface {
+class BookNodeIsRemovableAccessCheck implements AccessInterface{
/**
* Book Manager Service.
diff --git a/core/modules/book/src/BookManager.php b/core/modules/book/src/BookManager.php
index 2942462..2592f54 100644
--- a/core/modules/book/src/BookManager.php
+++ b/core/modules/book/src/BookManager.php
@@ -720,7 +720,7 @@ public function bookTreeGetFlat(array $book_link) {
* @param array $flat
* A flat array of the menu links from $tree, passed by reference.
*
- * @see static::bookTreeGetFlat()
+ * @see static::bookTreeGetFlat().
*/
protected function flatBookTree(array $tree, array &$flat) {
foreach ($tree as $data) {
diff --git a/core/modules/book/src/Cache/BookNavigationCacheContext.php b/core/modules/book/src/Cache/BookNavigationCacheContext.php
index 521d50b..4fe5ec1 100644
--- a/core/modules/book/src/Cache/BookNavigationCacheContext.php
+++ b/core/modules/book/src/Cache/BookNavigationCacheContext.php
@@ -4,8 +4,7 @@
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Cache\Context\CacheContextInterface;
-use Symfony\Component\DependencyInjection\ContainerAwareInterface;
-use Symfony\Component\DependencyInjection\ContainerAwareTrait;
+use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\HttpFoundation\RequestStack;
/**
@@ -20,9 +19,7 @@
* This class is container-aware to avoid initializing the 'book.manager'
* service when it is not necessary.
*/
-class BookNavigationCacheContext implements CacheContextInterface, ContainerAwareInterface {
-
- use ContainerAwareTrait;
+class BookNavigationCacheContext extends ContainerAware implements CacheContextInterface {
/**
* The request stack.
diff --git a/core/modules/comment/src/Entity/Comment.php b/core/modules/comment/src/Entity/Comment.php
index d626be3..7a659f8 100644
--- a/core/modules/comment/src/Entity/Comment.php
+++ b/core/modules/comment/src/Entity/Comment.php
@@ -208,18 +208,16 @@ public function permalink() {
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
- /** @var \Drupal\Core\Field\BaseFieldDefinition[] $fields */
- $fields = parent::baseFieldDefinitions($entity_type);
+ $fields['cid'] = BaseFieldDefinition::create('integer')
+ ->setLabel(t('Comment ID'))
+ ->setDescription(t('The comment ID.'))
+ ->setReadOnly(TRUE)
+ ->setSetting('unsigned', TRUE);
- $fields['cid']->setLabel(t('Comment ID'))
- ->setDescription(t('The comment ID.'));
-
- $fields['uuid']->setDescription(t('The comment UUID.'));
-
- $fields['comment_type']->setLabel(t('Comment Type'))
- ->setDescription(t('The comment type.'));
-
- $fields['langcode']->setDescription(t('The comment language code.'));
+ $fields['uuid'] = BaseFieldDefinition::create('uuid')
+ ->setLabel(t('UUID'))
+ ->setDescription(t('The comment UUID.'))
+ ->setReadOnly(TRUE);
$fields['pid'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Parent ID'))
@@ -231,6 +229,18 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
->setDescription(t('The ID of the entity of which this comment is a reply.'))
->setRequired(TRUE);
+ $fields['langcode'] = BaseFieldDefinition::create('language')
+ ->setLabel(t('Language'))
+ ->setDescription(t('The comment language code.'))
+ ->setTranslatable(TRUE)
+ ->setDisplayOptions('view', array(
+ 'type' => 'hidden',
+ ))
+ ->setDisplayOptions('form', array(
+ 'type' => 'language_select',
+ 'weight' => 2,
+ ));
+
$fields['subject'] = BaseFieldDefinition::create('string')
->setLabel(t('Subject'))
->setTranslatable(TRUE)
@@ -302,6 +312,11 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
->setSetting('is_ascii', TRUE)
->setSetting('max_length', EntityTypeInterface::ID_MAX_LENGTH);
+ $fields['comment_type'] = BaseFieldDefinition::create('entity_reference')
+ ->setLabel(t('Comment Type'))
+ ->setDescription(t('The comment type.'))
+ ->setSetting('target_type', 'comment_type');
+
$fields['field_name'] = BaseFieldDefinition::create('string')
->setLabel(t('Comment field name'))
->setDescription(t('The field name through which this comment was added.'))
diff --git a/core/modules/comment/src/Tests/CommentActionsTest.php b/core/modules/comment/src/Tests/CommentActionsTest.php
index 220be20..2c5e863 100644
--- a/core/modules/comment/src/Tests/CommentActionsTest.php
+++ b/core/modules/comment/src/Tests/CommentActionsTest.php
@@ -29,12 +29,12 @@ function testCommentPublishUnpublishActions() {
$comment = $this->postComment($this->node, $comment_text, $subject);
// Unpublish a comment.
- $action = Action::load('comment_unpublish_action');
+ $action = entity_load('action', 'comment_unpublish_action');
$action->execute(array($comment));
$this->assertTrue($comment->isPublished() === FALSE, 'Comment was unpublished');
// Publish a comment.
- $action = Action::load('comment_publish_action');
+ $action = entity_load('action', 'comment_publish_action');
$action->execute(array($comment));
$this->assertTrue($comment->isPublished() === TRUE, 'Comment was published');
}
diff --git a/core/modules/config/src/Form/ConfigImportForm.php b/core/modules/config/src/Form/ConfigImportForm.php
index f95b7a5..c0f606b 100644
--- a/core/modules/config/src/Form/ConfigImportForm.php
+++ b/core/modules/config/src/Form/ConfigImportForm.php
@@ -67,16 +67,13 @@ public function buildForm(array $form, FormStateInterface $form_state) {
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
- $all_files = $this->getRequest()->files->get('files', []);
- if (!empty($all_files['import_tarball'])) {
- $file_upload = $all_files['import_tarball'];
- if ($file_upload->isValid()) {
- $form_state->setValue('import_tarball', $file_upload->getRealPath());
- return;
- }
+ $file_upload = $this->getRequest()->files->get('files[import_tarball]', NULL, TRUE);
+ if ($file_upload && $file_upload->isValid()) {
+ $form_state->setValue('import_tarball', $file_upload->getRealPath());
+ }
+ else {
+ $form_state->setErrorByName('import_tarball', $this->t('The file could not be uploaded.'));
}
-
- $form_state->setErrorByName('import_tarball', $this->t('The file could not be uploaded.'));
}
/**
diff --git a/core/modules/contact/src/Entity/Message.php b/core/modules/contact/src/Entity/Message.php
index 20f360f..86ee30b 100644
--- a/core/modules/contact/src/Entity/Message.php
+++ b/core/modules/contact/src/Entity/Message.php
@@ -130,15 +130,24 @@ public function getPersonalRecipient() {
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
- /** @var \Drupal\Core\Field\BaseFieldDefinition[] $fields */
- $fields = parent::baseFieldDefinitions($entity_type);
-
- $fields['contact_form']->setLabel(t('Form ID'))
- ->setDescription(t('The ID of the associated form.'));
-
- $fields['uuid']->setDescription(t('The message UUID.'));
-
- $fields['langcode']->setDescription(t('The message language code.'));
+ $fields['contact_form'] = BaseFieldDefinition::create('entity_reference')
+ ->setLabel(t('Form ID'))
+ ->setDescription(t('The ID of the associated form.'))
+ ->setSetting('target_type', 'contact_form')
+ ->setRequired(TRUE);
+
+ $fields['uuid'] = BaseFieldDefinition::create('uuid')
+ ->setLabel(t('UUID'))
+ ->setDescription(t('The message UUID.'))
+ ->setReadOnly(TRUE);
+
+ $fields['langcode'] = BaseFieldDefinition::create('language')
+ ->setLabel(t('Language'))
+ ->setDescription(t('The message language code.'))
+ ->setDisplayOptions('form', array(
+ 'type' => 'language_select',
+ 'weight' => 2,
+ ));
$fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t("The sender's name"))
diff --git a/core/modules/dblog/src/Tests/DbLogTest.php b/core/modules/dblog/src/Tests/DbLogTest.php
index e38ae85..4121395 100644
--- a/core/modules/dblog/src/Tests/DbLogTest.php
+++ b/core/modules/dblog/src/Tests/DbLogTest.php
@@ -84,39 +84,6 @@ function testDbLog() {
}
/**
- * Test individual log event page.
- */
- public function testLogEventPage() {
- // Login the admin user.
- $this->drupalLogin($this->adminUser);
-
- // Since referrer and location links vary by how the tests are run, inject
- // fake log data to test these.
- $context = [
- 'request_uri' => 'http://example.com?dblog=1',
- 'referer' => 'http://example.org?dblog=2',
- 'uid' => 0,
- 'channel' => 'testing',
- 'link' => 'foo/bar',
- 'ip' => '0.0.1.0',
- 'timestamp' => REQUEST_TIME,
- ];
- \Drupal::service('logger.dblog')->log(RfcLogLevel::NOTICE, 'Test message', $context);
- $wid = db_query('SELECT MAX(wid) FROM {watchdog}')->fetchField();
-
- // Verify the links appear correctly.
- $this->drupalGet('admin/reports/dblog/event/' . $wid);
- $this->assertLinkByHref($context['request_uri']);
- $this->assertLinkByHref($context['referer']);
-
- // Verify hostname.
- $this->assertRaw($context['ip'], 'Found hostname on the detail page.');
-
- // Verify severity.
- $this->assertText('Notice', 'The severity was properly displayed on the detail page.');
- }
-
- /**
* Verifies setting of the database log row limit.
*
* @param int $row_limit
@@ -163,7 +130,7 @@ private function verifyCron($row_limit) {
$module_count = count($list);
$count = $current_id - $last_id;
- $this->assertTrue(($current_id - $last_id) == $module_count + 2, format_string('Cron added @count of @expected new log entries', array('@count' => $count, '@expected' => $module_count + 2)));
+ $this->assertTrue(($current_id - $last_id) == $module_count + 1, format_string('Cron added @count of @expected new log entries', array('@count' => $count, '@expected' => $module_count + 1)));
}
/**
@@ -262,6 +229,7 @@ private function verifyReports($response = 200) {
if ($response == 200) {
$this->assertText(t('Details'), 'DBLog event node was displayed');
}
+
}
/**
diff --git a/core/modules/editor/src/Form/EditorImageDialog.php b/core/modules/editor/src/Form/EditorImageDialog.php
index c353e2d..de27556 100644
--- a/core/modules/editor/src/Form/EditorImageDialog.php
+++ b/core/modules/editor/src/Form/EditorImageDialog.php
@@ -85,8 +85,8 @@ public function buildForm(array $form, FormStateInterface $form_state, FilterFor
// Construct strings to use in the upload validators.
$image_upload = $editor->getImageUploadSettings();
- if (!empty($image_upload['max_dimensions']['width']) || !empty($image_upload['max_dimensions']['height'])) {
- $max_dimensions = $image_upload['max_dimensions']['width'] . 'x' . $image_upload['max_dimensions']['height'];
+ if (!empty($image_upload['dimensions'])) {
+ $max_dimensions = $image_upload['dimensions']['max_width'] . '×' . $image_upload['dimensions']['max_height'];
}
else {
$max_dimensions = 0;
diff --git a/core/modules/editor/src/Tests/EditorUploadImageScaleTest.php b/core/modules/editor/src/Tests/EditorUploadImageScaleTest.php
deleted file mode 100644
index ac6e46b..0000000
--- a/core/modules/editor/src/Tests/EditorUploadImageScaleTest.php
+++ /dev/null
@@ -1,172 +0,0 @@
- 'basic_html',
- 'name' => 'Basic HTML',
- 'weight' => 0,
- ])->save();
-
- // Set up text editor.
- Editor::create([
- 'format' => 'basic_html',
- 'editor' => 'unicorn',
- 'image_upload' => [
- 'status' => TRUE,
- 'scheme' => 'public',
- 'directory' => 'inline-images',
- 'max_size' => '',
- 'max_dimensions' => [
- 'width' => '',
- 'height' => ''
- ],
- ]
- ])->save();
-
- // Create admin user.
- $this->adminUser = $this->drupalCreateUser(['administer filters', 'use text format basic_html']);
- $this->drupalLogin($this->adminUser);
- }
-
- /**
- * Tests scaling of inline images.
- */
- public function testEditorUploadImageScale() {
- // Generate testing images.
- $testing_image_list = $this->drupalGetTestFiles('image');
-
- // Case 1: no max dimensions set: uploaded image not scaled.
- $test_image = $testing_image_list[0];
- list($image_file_width, $image_file_height) = $this->getTestImageInfo($test_image->uri);
- $max_width = '';
- $max_height = '';
- $this->setMaxDimensions($max_width, $max_height);
- list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri);
- $this->assertEqual($uploaded_image_file_width, $image_file_width);
- $this->assertEqual($uploaded_image_file_height, $image_file_height);
- $this->assertNoRaw(t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', ['%dimensions' => $max_width . 'x' . $max_height]));
-
- // Case 2: max width smaller than uploaded image: image scaled down.
- $test_image = $testing_image_list[1];
- list($image_file_width, $image_file_height) = $this->getTestImageInfo($test_image->uri);
- $max_width = $image_file_width - 5;
- $max_height = $image_file_height;
- $this->setMaxDimensions($max_width, $max_height);
- list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri);
- $this->assertEqual($uploaded_image_file_width, $max_width);
- $this->assertEqual($uploaded_image_file_height, $uploaded_image_file_height * ($uploaded_image_file_width / $max_width));
- $this->assertRaw(t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', ['%dimensions' => $max_width . 'x' . $max_height]));
-
- // Case 3: max height smaller than uploaded image: image scaled down.
- $test_image = $testing_image_list[2];
- list($image_file_width, $image_file_height) = $this->getTestImageInfo($test_image->uri);
- $max_width = $image_file_width;
- $max_height = $image_file_height - 5;
- $this->setMaxDimensions($max_width, $max_height);
- list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri);
- $this->assertEqual($uploaded_image_file_width, $uploaded_image_file_width * ($uploaded_image_file_height / $max_height));
- $this->assertEqual($uploaded_image_file_height, $max_height);
- $this->assertRaw(t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', ['%dimensions' => $max_width . 'x' . $max_height]));
-
- // Case 4: max dimensions greater than uploaded image: image not scaled.
- $test_image = $testing_image_list[3];
- list($image_file_width, $image_file_height) = $this->getTestImageInfo($test_image->uri);
- $max_width = $image_file_width + 5;
- $max_height = $image_file_height + 5;
- $this->setMaxDimensions($max_width, $max_height);
- list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri);
- $this->assertEqual($uploaded_image_file_width, $image_file_width);
- $this->assertEqual($uploaded_image_file_height, $image_file_height);
- $this->assertNoRaw(t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', ['%dimensions' => $max_width . 'x' . $max_height]));
- }
-
- /**
- * Gets the dimensions of an uploaded image.
- *
- * @param string $uri
- * The URI of the image.
- *
- * @return array
- * An array containing the uploaded image's width and height.
- */
- protected function getTestImageInfo($uri) {
- $image_file = $this->container->get('image.factory')->get($uri);
- return [
- (int) $image_file->getWidth(),
- (int) $image_file->getHeight(),
- ];
- }
-
- /**
- * Sets the maximum dimensions and saves the configuration.
- *
- * @param string|int $width
- * The width of the image.
- * @param string|int $height
- * The height of the image.
- */
- protected function setMaxDimensions($width, $height) {
- $editor = Editor::load('basic_html');
- $image_upload_settings = $editor->getImageUploadSettings();
- $image_upload_settings['max_dimensions']['width'] = $width;
- $image_upload_settings['max_dimensions']['height'] = $height;
- $editor->setImageUploadSettings($image_upload_settings);
- $editor->save();
- }
-
- /**
- * Uploads an image via the editor dialog.
- *
- * @param string $uri
- * The URI of the image.
- *
- * @return array
- * An array containing the uploaded image's width and height.
- */
- protected function uploadImage($uri) {
- $edit = [
- 'files[fid]' => drupal_realpath($uri),
- ];
- $this->drupalGet('editor/dialog/image/basic_html');
- $this->drupalPostForm('editor/dialog/image/basic_html', $edit, t('Upload'));
- $uploaded_image_file = $this->container->get('image.factory')->get('public://inline-images/' . basename($uri));
- return [
- (int) $uploaded_image_file->getWidth(),
- (int) $uploaded_image_file->getHeight(),
- ];
- }
-
-}
diff --git a/core/modules/field/src/Entity/FieldStorageConfig.php b/core/modules/field/src/Entity/FieldStorageConfig.php
index 00883d6..d04454e 100644
--- a/core/modules/field/src/Entity/FieldStorageConfig.php
+++ b/core/modules/field/src/Entity/FieldStorageConfig.php
@@ -298,8 +298,7 @@ public function preSave(EntityStorageInterface $storage) {
* @param \Drupal\Core\Entity\EntityStorageInterface $storage
* The entity storage.
*
- * @throws \Drupal\Core\Field\FieldException
- * If the field definition is invalid.
+ * @throws \Drupal\Core\Field\FieldException If the field definition is invalid.
*/
protected function preSaveNew(EntityStorageInterface $storage) {
$entity_manager = \Drupal::entityManager();
diff --git a/core/modules/field_ui/field_ui.api.php b/core/modules/field_ui/field_ui.api.php
index 28cb246..4e44c3a 100644
--- a/core/modules/field_ui/field_ui.api.php
+++ b/core/modules/field_ui/field_ui.api.php
@@ -27,7 +27,7 @@
* @return array
* Returns the form array to be built.
*
- * @see \Drupal\field_ui\DisplayOverView
+ * @see \Drupal\field_ui\DisplayOverView.
*/
function hook_field_formatter_third_party_settings_form(\Drupal\Core\Field\FormatterInterface $plugin, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, $view_mode, $form, \Drupal\Core\Form\FormStateInterface $form_state) {
$element = array();
@@ -60,7 +60,7 @@ function hook_field_formatter_third_party_settings_form(\Drupal\Core\Field\Forma
* @return array
* Returns the form array to be built.
*
- * @see \Drupal\field_ui\FormDisplayOverView
+ * @see \Drupal\field_ui\FormDisplayOverView.
*/
function hook_field_widget_third_party_settings_form(\Drupal\Core\Field\WidgetInterface $plugin, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, $form_mode, $form, \Drupal\Core\Form\FormStateInterface $form_state) {
$element = array();
@@ -87,7 +87,7 @@ function hook_field_widget_third_party_settings_form(\Drupal\Core\Field\WidgetIn
* - field_definition: The field definition.
* - view_mode: The view mode being configured.
*
- * @see \Drupal\field_ui\DisplayOverView
+ * @see \Drupal\field_ui\DisplayOverView.
*/
function hook_field_formatter_settings_summary_alter(&$summary, $context) {
// Append a message to the summary when an instance of foo_formatter has
@@ -110,7 +110,7 @@ function hook_field_formatter_settings_summary_alter(&$summary, $context) {
* - field_definition: The field definition.
* - form_mode: The form mode being configured.
*
- * @see \Drupal\field_ui\FormDisplayOverView
+ * @see \Drupal\field_ui\FormDisplayOverView.
*/
function hook_field_widget_settings_summary_alter(&$summary, $context) {
// Append a message to the summary when an instance of foo_widget has
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index bbf3bff..0e5b057 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -709,12 +709,11 @@ function file_save_upload($form_field_name, $validators = array(), $destination
$user = \Drupal::currentUser();
static $upload_cache;
- $all_files = \Drupal::request()->files->get('files', array());
+ $file_upload = \Drupal::request()->files->get("files[$form_field_name]", NULL, TRUE);
// Make sure there's an upload to process.
- if (empty($all_files[$form_field_name])) {
+ if (empty($file_upload)) {
return NULL;
}
- $file_upload = $all_files[$form_field_name];
// Return cached objects without processing since the file will have
// already been processed and the paths in $_FILES will be invalid.
@@ -1169,11 +1168,10 @@ function file_managed_file_submit($form, FormStateInterface $form_state) {
*/
function file_managed_file_save_upload($element, FormStateInterface $form_state) {
$upload_name = implode('_', $element['#parents']);
- $all_files = \Drupal::request()->files->get('files', array());
- if (empty($all_files[$upload_name])) {
+ $file_upload = \Drupal::request()->files->get("files[$upload_name]", NULL, TRUE);
+ if (empty($file_upload)) {
return FALSE;
}
- $file_upload = $all_files[$upload_name];
$destination = isset($element['#upload_location']) ? $element['#upload_location'] : NULL;
if (isset($destination) && !file_prepare_directory($destination, FILE_CREATE_DIRECTORY)) {
diff --git a/core/modules/file/src/Entity/File.php b/core/modules/file/src/Entity/File.php
index da6d7c5..0c34871 100644
--- a/core/modules/file/src/Entity/File.php
+++ b/core/modules/file/src/Entity/File.php
@@ -186,11 +186,7 @@ public static function preCreate(EntityStorageInterface $storage, array &$values
public function preSave(EntityStorageInterface $storage) {
parent::preSave($storage);
- // The file itself might not exist or be available right now.
- $uri = $this->getFileUri();
- if ($size = @filesize($uri)) {
- $this->setSize($size);
- }
+ $this->setSize(filesize($this->getFileUri()));
}
/**
@@ -218,16 +214,20 @@ public static function preDelete(EntityStorageInterface $storage, array $entitie
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
- /** @var \Drupal\Core\Field\BaseFieldDefinition[] $fields */
- $fields = parent::baseFieldDefinitions($entity_type);
-
- $fields['fid']->setLabel(t('File ID'))
- ->setDescription(t('The file ID.'));
-
- $fields['uuid']->setDescription(t('The file UUID.'));
-
- $fields['langcode']->setLabel(t('Language code'))
- ->setDescription(t('The file language code.'));
+ $fields['fid'] = BaseFieldDefinition::create('integer')
+ ->setLabel(t('File ID'))
+ ->setDescription(t('The file ID.'))
+ ->setReadOnly(TRUE)
+ ->setSetting('unsigned', TRUE);
+
+ $fields['uuid'] = BaseFieldDefinition::create('uuid')
+ ->setLabel(t('UUID'))
+ ->setDescription(t('The file UUID.'))
+ ->setReadOnly(TRUE);
+
+ $fields['langcode'] = BaseFieldDefinition::create('language')
+ ->setLabel(t('Language code'))
+ ->setDescription(t('The file language code.'));
$fields['uid'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('User ID'))
diff --git a/core/modules/file/src/Tests/FileManagedFileElementTest.php b/core/modules/file/src/Tests/FileManagedFileElementTest.php
index 07102a0..f5d5be3 100644
--- a/core/modules/file/src/Tests/FileManagedFileElementTest.php
+++ b/core/modules/file/src/Tests/FileManagedFileElementTest.php
@@ -171,27 +171,4 @@ public function testManagedFileRemoved() {
$this->assertRaw('The file referenced by the Managed file & butter field does not exist.');
}
- /**
- * Ensure a file entity can be saved when the file does not exist on disk.
- */
- public function testFileRemovedFromDisk() {
- $this->drupalGet('file/test/1/0/1');
- $test_file = $this->getTestFile('text');
- $file_field_name = 'files[nested_file][]';
-
- $edit = [$file_field_name => drupal_realpath($test_file->getFileUri())];
- $this->drupalPostForm(NULL, $edit, t('Upload'));
- $this->drupalPostForm(NULL, array(), t('Save'));
-
- $fid = $this->getLastFileId();
- /** @var $file \Drupal\file\FileInterface */
- $file = $this->container->get('entity_type.manager')->getStorage('file')->load($fid);
- $file->setPermanent();
- $file->save();
- $this->assertTrue(file_unmanaged_delete($file->getFileUri()));
- $file->save();
- $this->assertTrue($file->isPermanent());
- $file->delete();
- }
-
}
diff --git a/core/modules/forum/src/Breadcrumb/ForumBreadcrumbBuilderBase.php b/core/modules/forum/src/Breadcrumb/ForumBreadcrumbBuilderBase.php
index 6604001..4bde297 100644
--- a/core/modules/forum/src/Breadcrumb/ForumBreadcrumbBuilderBase.php
+++ b/core/modules/forum/src/Breadcrumb/ForumBreadcrumbBuilderBase.php
@@ -17,7 +17,7 @@
* This just holds the dependency-injected config, entity manager, and forum
* manager objects.
*/
-abstract class ForumBreadcrumbBuilderBase implements BreadcrumbBuilderInterface {
+abstract class ForumBreadcrumbBuilderBase implements BreadcrumbBuilderInterface {
use StringTranslationTrait;
/**
diff --git a/core/modules/language/src/ContentLanguageSettingsInterface.php b/core/modules/language/src/ContentLanguageSettingsInterface.php
index 7e1211d..3bb3d5d 100644
--- a/core/modules/language/src/ContentLanguageSettingsInterface.php
+++ b/core/modules/language/src/ContentLanguageSettingsInterface.php
@@ -39,7 +39,7 @@ public function setTargetBundle($target_bundle);
* @param string $default_langcode
* The default language code.
*
- * @return $this
+ * @return $this;
*/
public function setDefaultLangcode($default_langcode);
diff --git a/core/modules/language/src/Tests/LanguageConfigurationElementTest.php b/core/modules/language/src/Tests/LanguageConfigurationElementTest.php
index 93b821d..21288a2 100644
--- a/core/modules/language/src/Tests/LanguageConfigurationElementTest.php
+++ b/core/modules/language/src/Tests/LanguageConfigurationElementTest.php
@@ -109,7 +109,7 @@ public function testDefaultLangcode() {
// Site's default.
$old_default = \Drupal::languageManager()->getDefaultLanguage();
// Ensure the language entity default value is correct.
- $configurable_language = ConfigurableLanguage::load($old_default->getId());
+ $configurable_language = entity_load('configurable_language', $old_default->getId());
$this->assertTrue($configurable_language->isDefault(), 'The en language entity is flagged as the default language.');
$this->config('system.site')->set('default_langcode', 'cc')->save();
@@ -121,9 +121,9 @@ public function testDefaultLangcode() {
$this->assertEqual($langcode, 'cc');
// Ensure the language entity default value is correct.
- $configurable_language = ConfigurableLanguage::load($old_default->getId());
+ $configurable_language = entity_load('configurable_language', $old_default->getId());
$this->assertFalse($configurable_language->isDefault(), 'The en language entity is not flagged as the default language.');
- $configurable_language = ConfigurableLanguage::load('cc');
+ $configurable_language = entity_load('configurable_language', 'cc');
// Check calling the
// \Drupal\language\ConfigurableLanguageInterface::isDefault() method
// directly.
diff --git a/core/modules/language/src/Tests/LanguageConfigurationTest.php b/core/modules/language/src/Tests/LanguageConfigurationTest.php
index cf049f1..c83cc61 100644
--- a/core/modules/language/src/Tests/LanguageConfigurationTest.php
+++ b/core/modules/language/src/Tests/LanguageConfigurationTest.php
@@ -204,11 +204,8 @@ protected function checkConfigurableLanguageWeight($state = 'by default') {
protected function getHighestConfigurableLanguageWeight(){
$max_weight = 0;
- $storage = $this->container->get('entity_type.manager')
- ->getStorage('configurable_language');
- $storage->resetCache();
/* @var $languages \Drupal\Core\Language\LanguageInterface[] */
- $languages = $storage->loadMultiple();
+ $languages = entity_load_multiple('configurable_language', NULL, TRUE);
foreach ($languages as $language) {
if (!$language->isLocked()) {
$max_weight = max($max_weight, $language->getWeight());
diff --git a/core/modules/locale/src/LocaleConfigManager.php b/core/modules/locale/src/LocaleConfigManager.php
index 2de875e..1a8aef8 100644
--- a/core/modules/locale/src/LocaleConfigManager.php
+++ b/core/modules/locale/src/LocaleConfigManager.php
@@ -204,6 +204,7 @@ protected function getTranslatableData(TypedDataInterface $element) {
* The translatable array structure. A nested array matching the exact
* structure under of the default configuration for $name with only the
* elements that are translatable wrapped into a TranslatableMarkup.
+ * @see self::getTranslatableData().
* @param string $langcode
* The language code to process the array with.
*
@@ -211,8 +212,6 @@ protected function getTranslatableData(TypedDataInterface $element) {
* Processed translatable data array. Will only contain translations
* different from source strings or in case of untranslatable English, the
* source strings themselves.
- *
- * @see self::getTranslatableData()
*/
protected function processTranslatableData($name, array $active, array $translatable, $langcode) {
$translated = array();
diff --git a/core/modules/locale/src/StreamWrapper/TranslationsStream.php b/core/modules/locale/src/StreamWrapper/TranslationsStream.php
index 8a1c1c9..d59949b 100644
--- a/core/modules/locale/src/StreamWrapper/TranslationsStream.php
+++ b/core/modules/locale/src/StreamWrapper/TranslationsStream.php
@@ -42,8 +42,7 @@ function getDirectoryPath() {
/**
* Implements Drupal\Core\StreamWrapper\StreamWrapperInterface::getExternalUrl().
- * @throws \LogicException
- * PO files URL should not be public.
+ * @throws \LogicException PO files URL should not be public.
*/
function getExternalUrl() {
throw new \LogicException('PO files URL should not be public.');
diff --git a/core/modules/menu_link_content/src/Entity/MenuLinkContent.php b/core/modules/menu_link_content/src/Entity/MenuLinkContent.php
index d70889b..d0f4bc5 100644
--- a/core/modules/menu_link_content/src/Entity/MenuLinkContent.php
+++ b/core/modules/menu_link_content/src/Entity/MenuLinkContent.php
@@ -233,20 +233,23 @@ public static function preDelete(EntityStorageInterface $storage, array $entitie
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
- /** @var \Drupal\Core\Field\BaseFieldDefinition[] $fields */
- $fields = parent::baseFieldDefinitions($entity_type);
-
- $fields['id'] ->setLabel(t('Entity ID'))
- ->setDescription(t('The entity ID for this menu link content entity.'));
-
- $fields['uuid']->setDescription(t('The content menu link UUID.'));
-
- $fields['langcode']->setDescription(t('The menu link language code.'));
-
- $fields['bundle']
+ $fields['id'] = BaseFieldDefinition::create('integer')
+ ->setLabel(t('Entity ID'))
+ ->setDescription(t('The entity ID for this menu link content entity.'))
+ ->setReadOnly(TRUE)
+ ->setSetting('unsigned', TRUE);
+
+ $fields['uuid'] = BaseFieldDefinition::create('uuid')
+ ->setLabel(t('UUID'))
+ ->setDescription(t('The content menu link UUID.'))
+ ->setReadOnly(TRUE);
+
+ $fields['bundle'] = BaseFieldDefinition::create('string')
+ ->setLabel(t('Bundle'))
->setDescription(t('The content menu link bundle.'))
->setSetting('max_length', EntityTypeInterface::BUNDLE_MAX_LENGTH)
- ->setSetting('is_ascii', TRUE);
+ ->setSetting('is_ascii', TRUE)
+ ->setReadOnly(TRUE);
$fields['title'] = BaseFieldDefinition::create('string')
->setLabel(t('Menu link title'))
@@ -350,6 +353,18 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
'weight' => -1,
));
+ $fields['langcode'] = BaseFieldDefinition::create('language')
+ ->setLabel(t('Language'))
+ ->setDescription(t('The menu link language code.'))
+ ->setTranslatable(TRUE)
+ ->setDisplayOptions('view', array(
+ 'type' => 'hidden',
+ ))
+ ->setDisplayOptions('form', array(
+ 'type' => 'language_select',
+ 'weight' => 2,
+ ));
+
$fields['parent'] = BaseFieldDefinition::create('string')
->setLabel(t('Parent plugin ID'))
->setDescription(t('The ID of the parent menu link plugin, or empty string when at the top level of the hierarchy.'));
diff --git a/core/modules/menu_ui/menu_ui.module b/core/modules/menu_ui/menu_ui.module
index d642247..f03d4af 100644
--- a/core/modules/menu_ui/menu_ui.module
+++ b/core/modules/menu_ui/menu_ui.module
@@ -389,8 +389,8 @@ function menu_ui_form_node_form_submit($form, FormStateInterface $form_state) {
*
* Adds menu options to the node type form.
*
- * @see NodeTypeForm::form()
- * @see menu_ui_form_node_type_form_submit()
+ * @see NodeTypeForm::form().
+ * @see menu_ui_form_node_type_form_submit().
*/
function menu_ui_form_node_type_form_alter(&$form, FormStateInterface $form_state) {
/** @var \Drupal\Core\Menu\MenuParentFormSelectorInterface $menu_parent_selector */
@@ -437,7 +437,7 @@ function menu_ui_form_node_type_form_alter(&$form, FormStateInterface $form_stat
/**
* Submit handler for forms with menu options.
*
- * @see menu_ui_form_node_type_form_alter()
+ * @see menu_ui_form_node_type_form_alter().
*/
function menu_ui_form_node_type_form_validate(&$form, FormStateInterface $form_state) {
$available_menus = array_filter($form_state->getValue('menu_options'));
@@ -457,7 +457,7 @@ function menu_ui_form_node_type_form_validate(&$form, FormStateInterface $form_s
/**
* Entity builder for the node type form with menu options.
*
- * @see menu_ui_form_node_type_form_alter()
+ * @see menu_ui_form_node_type_form_alter().
*/
function menu_ui_form_node_type_form_builder($entity_type, NodeTypeInterface $type, &$form, FormStateInterface $form_state) {
$type->setThirdPartySetting('menu_ui', 'available_menus', array_values(array_filter($form_state->getValue('menu_options'))));
diff --git a/core/modules/migrate/migrate.services.yml b/core/modules/migrate/migrate.services.yml
index 2c59d1c..da43b38 100644
--- a/core/modules/migrate/migrate.services.yml
+++ b/core/modules/migrate/migrate.services.yml
@@ -17,12 +17,6 @@ services:
plugin.manager.migrate.id_map:
class: Drupal\migrate\Plugin\MigratePluginManager
arguments: [id_map, '@container.namespaces', '@cache.discovery', '@module_handler']
- cache.discovery_migration:
- class: Drupal\Core\Cache\CacheBackendInterface
- tags:
- - { name: cache.bin, default_backend: cache.backend.memory }
- factory: cache_factory:get
- arguments: [discovery_migration]
plugin.manager.migration:
class: Drupal\migrate\Plugin\MigrationPluginManager
- arguments: ['@module_handler', '@cache.discovery_migration', '@language_manager']
+ arguments: ['@module_handler', '@cache.discovery', '@language_manager']
diff --git a/core/modules/migrate/src/Plugin/MigrationInterface.php b/core/modules/migrate/src/Plugin/MigrationInterface.php
index 7572760..f61add0 100644
--- a/core/modules/migrate/src/Plugin/MigrationInterface.php
+++ b/core/modules/migrate/src/Plugin/MigrationInterface.php
@@ -279,7 +279,7 @@ public function setProcessOfProperty($property, $process_of_property);
* @return $this
* The migration entity.
*
- * @see Drupal\migrate_drupal\Plugin\migrate\load\LoadEntity::processLinkField()
+ * @see Drupal\migrate_drupal\Plugin\migrate\load\LoadEntity::processLinkField().
*/
public function mergeProcessOfProperty($property, array $process_of_property);
diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/cckfield/CckFieldPluginBase.php b/core/modules/migrate_drupal/src/Plugin/migrate/cckfield/CckFieldPluginBase.php
index 87d5457..abe3d04 100644
--- a/core/modules/migrate_drupal/src/Plugin/migrate/cckfield/CckFieldPluginBase.php
+++ b/core/modules/migrate_drupal/src/Plugin/migrate/cckfield/CckFieldPluginBase.php
@@ -17,7 +17,7 @@
*
* @ingroup migration
*/
-abstract class CckFieldPluginBase extends PluginBase implements MigrateCckFieldInterface {
+abstract class CckFieldPluginBase extends PluginBase implements MigrateCckFieldInterface {
/**
* {@inheritdoc}
diff --git a/core/modules/options/tests/options_test/options_test.module b/core/modules/options/tests/options_test/options_test.module
index d20401a..59b8e1c 100644
--- a/core/modules/options/tests/options_test/options_test.module
+++ b/core/modules/options/tests/options_test/options_test.module
@@ -11,7 +11,7 @@
/**
* Implements callback_allowed_values_function().
*
- * @see options_allowed_values()
+ * @see options_allowed_values().
*/
function options_test_allowed_values_callback(FieldStorageDefinitionInterface $definition, FieldableEntityInterface $entity = NULL) {
$values = array(
@@ -38,7 +38,7 @@ function options_test_allowed_values_callback(FieldStorageDefinitionInterface $d
* NULL. Since this is not yet used for testing Views integration, that is
* alright for now. Fix this in https://www.drupal.org/node/2012130.
*
- * @see options_allowed_values()
+ * @see options_allowed_values().
*/
function options_test_dynamic_values_callback(FieldStorageDefinitionInterface $definition, FieldableEntityInterface $entity = NULL, &$cacheable = NULL) {
$values = array();
diff --git a/core/modules/path/src/Plugin/Field/FieldType/PathItem.php b/core/modules/path/src/Plugin/Field/FieldType/PathItem.php
index 4ee5729..4a1a779 100644
--- a/core/modules/path/src/Plugin/Field/FieldType/PathItem.php
+++ b/core/modules/path/src/Plugin/Field/FieldType/PathItem.php
@@ -28,7 +28,7 @@ class PathItem extends FieldItemBase {
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
$properties['alias'] = DataDefinition::create('string')
->setLabel(t('Path alias'));
- $properties['pid'] = DataDefinition::create('integer')
+ $properties['pid'] = DataDefinition::create('string')
->setLabel(t('Path id'));
return $properties;
}
diff --git a/core/modules/rest/src/Plugin/Type/ResourcePluginManager.php b/core/modules/rest/src/Plugin/Type/ResourcePluginManager.php
index 4aa46b2..9a3587c 100644
--- a/core/modules/rest/src/Plugin/Type/ResourcePluginManager.php
+++ b/core/modules/rest/src/Plugin/Type/ResourcePluginManager.php
@@ -36,10 +36,6 @@ public function __construct(\Traversable $namespaces, CacheBackendInterface $cac
/**
* {@inheritdoc}
- *
- * @deprecated in Drupal 8.2.0.
- * Use Drupal\rest\Plugin\Type\ResourcePluginManager::createInstance()
- * instead.
*/
public function getInstance(array $options){
if (isset($options['id'])) {
diff --git a/core/modules/rest/src/RequestHandler.php b/core/modules/rest/src/RequestHandler.php
index 8e0cd74..00e6527 100644
--- a/core/modules/rest/src/RequestHandler.php
+++ b/core/modules/rest/src/RequestHandler.php
@@ -2,25 +2,53 @@
namespace Drupal\rest;
+use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Render\RenderContext;
use Drupal\Core\Routing\RouteMatchInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
+use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException;
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
-use Symfony\Component\Serializer\SerializerInterface;
/**
* Acts as intermediate request forwarder for resource plugins.
*/
-class RequestHandler implements ContainerAwareInterface {
+class RequestHandler implements ContainerAwareInterface, ContainerInjectionInterface {
use ContainerAwareTrait;
/**
+ * The controller resolver.
+ *
+ * @var \Symfony\Component\HttpKernel\Controller\ControllerResolverInterface
+ */
+ protected $controllerResolver;
+
+ /**
+ * Creates a new RequestHandler instance.
+ *
+ * @param \Symfony\Component\HttpKernel\Controller\ControllerResolverInterface $controller_resolver
+ * The controller resolver.
+ */
+ public function __construct(ControllerResolverInterface $controller_resolver) {
+ $this->controllerResolver = $controller_resolver;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function create(ContainerInterface $container) {
+ return new static(
+ $container->get('controller_resolver')
+ );
+ }
+
+ /**
* Handles a web API request.
*
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
@@ -38,7 +66,8 @@ public function handle(RouteMatchInterface $route_match, Request $request) {
$resource = $this->container
->get('plugin.manager.rest')
- ->createInstance($plugin);
+ ->getInstance(array('id' => $plugin));
+ $definition = $resource->getPluginDefinition();
// Deserialize incoming data if available.
$serializer = $this->container->get('serializer');
@@ -54,7 +83,6 @@ public function handle(RouteMatchInterface $route_match, Request $request) {
$config = $this->container->get('config.factory')->get('rest.settings')->get('resources');
$method_settings = $config[$plugin][$request->getMethod()];
if (empty($method_settings['supported_formats']) || in_array($format, $method_settings['supported_formats'])) {
- $definition = $resource->getPluginDefinition();
$class = $definition['serialization_class'];
try {
$unserialized = $serializer->deserialize($received, $class, $format, array('request_method' => $method));
@@ -70,24 +98,32 @@ public function handle(RouteMatchInterface $route_match, Request $request) {
}
}
- // Determine the request parameters that should be passed to the resource
- // plugin.
- $route_parameters = $route_match->getParameters();
- $parameters = array();
- // Filter out all internal parameters starting with "_".
- foreach ($route_parameters as $key => $parameter) {
- if ($key{0} !== '_') {
- $parameters[] = $parameter;
- }
- }
-
// Invoke the operation on the resource plugin.
// All REST routes are restricted to exactly one format, so instead of
// parsing it out of the Accept headers again, we can simply retrieve the
// format requirement. If there is no format associated, just pick JSON.
$format = $route_match->getRouteObject()->getRequirement('_format') ?: 'json';
try {
- $response = call_user_func_array(array($resource, $method), array_merge($parameters, array($unserialized, $request)));
+ if (!empty($definition['use_controller_resolver'])) {
+ $controller = [$resource, $method];
+ $request = clone $request;
+ $request->attributes['data'] = $unserialized;
+ $arguments = $this->controllerResolver->getArguments($request, $controller);
+ $response = call_user_func_array($controller, $arguments);
+ }
+ else {
+ // Determine the request parameters that should be passed to the resource
+ // plugin.
+ $route_parameters = $route_match->getParameters();
+ $parameters = array();
+ // Filter out all internal parameters starting with "_".
+ foreach ($route_parameters as $key => $parameter) {
+ if ($key{0} !== '_') {
+ $parameters[] = $parameter;
+ }
+ }
+ $response = call_user_func_array(array($resource, $method), array_merge($parameters, array($unserialized, $request)));
+ }
}
catch (HttpException $e) {
$error['error'] = $e->getMessage();
@@ -98,9 +134,29 @@ public function handle(RouteMatchInterface $route_match, Request $request) {
return new Response($content, $e->getStatusCode(), $headers);
}
- return $response instanceof ResourceResponse ?
- $this->renderResponse($request, $response, $serializer, $format) :
- $response;
+ if ($response instanceof ResourceResponse) {
+ $data = $response->getResponseData();
+ // Serialization can invoke rendering (e.g., generating URLs), but the
+ // serialization API does not provide a mechanism to collect the
+ // bubbleable metadata associated with that (e.g., language and other
+ // contexts), so instead, allow those to "leak" and collect them here in
+ // a render context.
+ // @todo Add test coverage for language negotiation contexts in
+ // https://www.drupal.org/node/2135829.
+ $context = new RenderContext();
+ $output = $this->container->get('renderer')->executeInRenderContext($context, function() use ($serializer, $data, $format) {
+ return $serializer->serialize($data, $format);
+ });
+ $response->setContent($output);
+ if (!$context->isEmpty()) {
+ $response->addCacheableDependency($context->pop());
+ }
+
+ $response->headers->set('Content-Type', $request->getMimeType($format));
+ // Add rest settings config's cache tags.
+ $response->addCacheableDependency($this->container->get('config.factory')->get('rest.settings'));
+ }
+ return $response;
}
/**
@@ -113,48 +169,4 @@ public function csrfToken() {
return new Response(\Drupal::csrfToken()->get('rest'), 200, array('Content-Type' => 'text/plain'));
}
- /**
- * Renders a resource response.
- *
- * Serialization can invoke rendering (e.g., generating URLs), but the
- * serialization API does not provide a mechanism to collect the
- * bubbleable metadata associated with that (e.g., language and other
- * contexts), so instead, allow those to "leak" and collect them here in
- * a render context.
- *
- * @param \Symfony\Component\HttpFoundation\Request $request
- * The request object.
- * @param \Drupal\rest\ResourceResponse $response
- * The response from the REST resource.
- * @param \Symfony\Component\Serializer\SerializerInterface $serializer
- * The serializer to use.
- * @param string $format
- * The response format.
- *
- * @return \Drupal\rest\ResourceResponse
- * The altered response.
- *
- * @todo Add test coverage for language negotiation contexts in
- * https://www.drupal.org/node/2135829.
- */
- protected function renderResponse(Request $request, ResourceResponse $response, SerializerInterface $serializer, $format) {
- $data = $response->getResponseData();
- $context = new RenderContext();
- $output = $this->container->get('renderer')
- ->executeInRenderContext($context, function () use ($serializer, $data, $format) {
- return $serializer->serialize($data, $format);
- });
- $response->setContent($output);
- if (!$context->isEmpty()) {
- $response->addCacheableDependency($context->pop());
- }
-
- $response->headers->set('Content-Type', $request->getMimeType($format));
- // Add rest settings config's cache tags.
- $response->addCacheableDependency($this->container->get('config.factory')
- ->get('rest.settings'));
-
- return $response;
- }
-
}
diff --git a/core/modules/rest/src/RestPermissions.php b/core/modules/rest/src/RestPermissions.php
index 57e95e4..5733ef2 100644
--- a/core/modules/rest/src/RestPermissions.php
+++ b/core/modules/rest/src/RestPermissions.php
@@ -55,8 +55,8 @@ public function permissions() {
$permissions = [];
$resources = $this->configFactory->get('rest.settings')->get('resources');
if ($resources && $enabled = array_intersect_key($this->restPluginManager->getDefinitions(), $resources)) {
- foreach ($enabled as $id => $resource) {
- $plugin = $this->restPluginManager->createInstance($id);
+ foreach ($enabled as $key => $resource) {
+ $plugin = $this->restPluginManager->getInstance(['id' => $key]);
$permissions = array_merge($permissions, $plugin->permissions());
}
}
diff --git a/core/modules/rest/src/Routing/ResourceRoutes.php b/core/modules/rest/src/Routing/ResourceRoutes.php
index e88f18b..fc72150 100644
--- a/core/modules/rest/src/Routing/ResourceRoutes.php
+++ b/core/modules/rest/src/Routing/ResourceRoutes.php
@@ -73,7 +73,8 @@ protected function alterRoutes(RouteCollection $collection) {
// Iterate over all enabled resource plugins.
foreach ($enabled_resources as $id => $enabled_methods) {
- $plugin = $this->manager->createInstance($id);
+ $plugin = $this->manager->getInstance(array('id' => $id));
+
foreach ($plugin->routes() as $name => $route) {
// @todo: Are multiple methods possible here?
$methods = $route->getMethods();
diff --git a/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php b/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php
index 36a482c..6c19ca4 100644
--- a/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php
+++ b/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php
@@ -55,7 +55,7 @@ public function testBaseHandler() {
// Setup stub plugin manager that will return our plugin.
$stub = $this->prophesize(ResourcePluginManager::class);
- $stub->createInstance('restplugin')
+ $stub->getInstance(['id' => 'restplugin'])
->willReturn($resource->reveal());
$this->container->set('plugin.manager.rest', $stub->reveal());
@@ -95,7 +95,7 @@ public function testSerialization($data) {
// Setup stub plugin manager that will return our plugin.
$stub = $this->prophesize(ResourcePluginManager::class);
- $stub->createInstance('restplugin')
+ $stub->getInstance(['id' => 'restplugin'])
->willReturn($resource->reveal());
$this->container->set('plugin.manager.rest', $stub->reveal());
diff --git a/core/modules/shortcut/src/Entity/Shortcut.php b/core/modules/shortcut/src/Entity/Shortcut.php
index 6ddaf05..94b5c62 100644
--- a/core/modules/shortcut/src/Entity/Shortcut.php
+++ b/core/modules/shortcut/src/Entity/Shortcut.php
@@ -105,17 +105,22 @@ public function postSave(EntityStorageInterface $storage, $update = TRUE) {
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
- /** @var \Drupal\Core\Field\BaseFieldDefinition[] $fields */
- $fields = parent::baseFieldDefinitions($entity_type);
-
- $fields['id']->setDescription(t('The ID of the shortcut.'));
-
- $fields['uuid']->setDescription(t('The UUID of the shortcut.'));
-
- $fields['shortcut_set']->setLabel(t('Shortcut set'))
- ->setDescription(t('The bundle of the shortcut.'));
-
- $fields['langcode']->setDescription(t('The language code of the shortcut.'));
+ $fields['id'] = BaseFieldDefinition::create('integer')
+ ->setLabel(t('ID'))
+ ->setDescription(t('The ID of the shortcut.'))
+ ->setReadOnly(TRUE)
+ ->setSetting('unsigned', TRUE);
+
+ $fields['uuid'] = BaseFieldDefinition::create('uuid')
+ ->setLabel(t('UUID'))
+ ->setDescription(t('The UUID of the shortcut.'))
+ ->setReadOnly(TRUE);
+
+ $fields['shortcut_set'] = BaseFieldDefinition::create('entity_reference')
+ ->setLabel(t('Shortcut set'))
+ ->setDescription(t('The bundle of the shortcut.'))
+ ->setSetting('target_type', 'shortcut_set')
+ ->setRequired(TRUE);
$fields['title'] = BaseFieldDefinition::create('string')
->setLabel(t('Name'))
@@ -149,6 +154,18 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
))
->setDisplayConfigurable('form', TRUE);
+ $fields['langcode'] = BaseFieldDefinition::create('language')
+ ->setLabel(t('Language'))
+ ->setDescription(t('The language code of the shortcut.'))
+ ->setTranslatable(TRUE)
+ ->setDisplayOptions('view', array(
+ 'type' => 'hidden',
+ ))
+ ->setDisplayOptions('form', array(
+ 'type' => 'language_select',
+ 'weight' => 2,
+ ));
+
return $fields;
}
diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module
index d8b653e..58ede7c 100644
--- a/core/modules/simpletest/simpletest.module
+++ b/core/modules/simpletest/simpletest.module
@@ -10,7 +10,6 @@
use Drupal\Core\Render\Element;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\simpletest\TestBase;
-use Drupal\Core\Test\TestDatabase;
use Drupal\simpletest\TestDiscovery;
use Symfony\Component\Process\PhpExecutableFinder;
@@ -213,7 +212,7 @@ function simpletest_process_phpunit_results($phpunit_results) {
// Insert the results of the PHPUnit test run into the database so the results
// are displayed along with Simpletest's results.
if (!empty($phpunit_results)) {
- $query = TestDatabase::getConnection()
+ $query = TestBase::getDatabaseConnection()
->insert('simpletest')
->fields(array_keys($phpunit_results[0]));
foreach ($phpunit_results as $result) {
@@ -429,12 +428,12 @@ function _simpletest_batch_finished($success, $results, $operations, $elapsed) {
* that ran.
*/
function simpletest_last_test_get($test_id) {
- $last_prefix = TestDatabase::getConnection()
+ $last_prefix = TestBase::getDatabaseConnection()
->queryRange('SELECT last_prefix FROM {simpletest_test_id} WHERE test_id = :test_id', 0, 1, array(
':test_id' => $test_id,
))
->fetchField();
- $last_test_class = TestDatabase::getConnection()
+ $last_test_class = TestBase::getDatabaseConnection()
->queryRange('SELECT test_class FROM {simpletest} WHERE test_id = :test_id ORDER BY message_id DESC', 0, 1, array(
':test_id' => $test_id,
))
@@ -644,7 +643,7 @@ function simpletest_clean_temporary_directories() {
*/
function simpletest_clean_results_table($test_id = NULL) {
if (\Drupal::config('simpletest.settings')->get('clear_results')) {
- $connection = TestDatabase::getConnection();
+ $connection = TestBase::getDatabaseConnection();
if ($test_id) {
$count = $connection->query('SELECT COUNT(test_id) FROM {simpletest_test_id} WHERE test_id = :test_id', array(':test_id' => $test_id))->fetchField();
diff --git a/core/modules/simpletest/src/AssertContentTrait.php b/core/modules/simpletest/src/AssertContentTrait.php
index e8da02c..8bbdb57 100644
--- a/core/modules/simpletest/src/AssertContentTrait.php
+++ b/core/modules/simpletest/src/AssertContentTrait.php
@@ -7,7 +7,7 @@
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Utility\Xss;
use Drupal\Core\Render\RenderContext;
-use Symfony\Component\CssSelector\CssSelectorConverter;
+use Symfony\Component\CssSelector\CssSelector;
/**
* Provides test methods to assert content.
@@ -247,7 +247,7 @@ protected function xpath($xpath, array $arguments = []) {
* selector to an XPath selector.
*/
protected function cssSelect($selector) {
- return $this->xpath((new CssSelectorConverter())->toXPath($selector));
+ return $this->xpath(CssSelector::toXPath($selector));
}
/**
diff --git a/core/modules/simpletest/src/TestBase.php b/core/modules/simpletest/src/TestBase.php
index 6bb84fd..9bc2c5b 100644
--- a/core/modules/simpletest/src/TestBase.php
+++ b/core/modules/simpletest/src/TestBase.php
@@ -9,10 +9,10 @@
use Drupal\Core\Database\Database;
use Drupal\Core\Config\ConfigImporter;
use Drupal\Core\Config\StorageComparer;
+use Drupal\Core\Database\ConnectionNotDefinedException;
use Drupal\Core\Config\StorageInterface;
use Drupal\Core\Site\Settings;
use Drupal\Core\StreamWrapper\PublicStream;
-use Drupal\Core\Test\TestDatabase;
use Drupal\Core\Utility\Error;
use Drupal\Tests\RandomGeneratorTrait;
use Drupal\Tests\SessionTestTrait;
@@ -510,7 +510,26 @@ public static function deleteAssert($message_id) {
* The database connection to use for inserting assertions.
*/
public static function getDatabaseConnection() {
- return TestDatabase::getConnection();
+ // Check whether there is a test runner connection.
+ // @see run-tests.sh
+ // @todo Convert Simpletest UI runner to create + use this connection, too.
+ try {
+ $connection = Database::getConnection('default', 'test-runner');
+ }
+ catch (ConnectionNotDefinedException $e) {
+ // Check whether there is a backup of the original default connection.
+ // @see TestBase::prepareEnvironment()
+ try {
+ $connection = Database::getConnection('default', 'simpletest_original_default');
+ }
+ catch (ConnectionNotDefinedException $e) {
+ // If TestBase::prepareEnvironment() or TestBase::restoreEnvironment()
+ // failed, the test-specific database connection does not exist
+ // yet/anymore, so fall back to the default of the (UI) test runner.
+ $connection = Database::getConnection('default', 'default');
+ }
+ }
+ return $connection;
}
/**
diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php
index eb1ad73..35d2324 100644
--- a/core/modules/simpletest/src/WebTestBase.php
+++ b/core/modules/simpletest/src/WebTestBase.php
@@ -1302,7 +1302,7 @@ protected function curlExec($curl_options, $redirect = FALSE) {
* @param $header
* An header.
*
- * @see _drupal_log_error()
+ * @see _drupal_log_error().
*/
protected function curlHeaderCallback($curlHandler, $header) {
// Header fields can be extended over multiple lines by preceding each
@@ -2631,7 +2631,7 @@ protected function assertNoResponse($code, $message = '', $group = 'Browser') {
* @param $override_server_vars
* An array of server variables to override.
*
- * @return \Symfony\Component\HttpFoundation\Request
+ * @return $request
* The mocked request object.
*/
protected function prepareRequestForGenerator($clean_urls = TRUE, $override_server_vars = array()) {
diff --git a/core/modules/system/src/Tests/Entity/EntityDefinitionTestTrait.php b/core/modules/system/src/Tests/Entity/EntityDefinitionTestTrait.php
index 0123597..84ef90d 100644
--- a/core/modules/system/src/Tests/Entity/EntityDefinitionTestTrait.php
+++ b/core/modules/system/src/Tests/Entity/EntityDefinitionTestTrait.php
@@ -199,7 +199,7 @@ protected function removeBundleField() {
/**
* Adds an index to the 'entity_test_update' entity type's base table.
*
- * @see \Drupal\entity_test\EntityTestStorageSchema::getEntitySchema()
+ * @see \Drupal\entity_test\EntityTestStorageSchema::getEntitySchema().
*/
protected function addEntityIndex() {
$indexes = array(
diff --git a/core/modules/system/src/Tests/Menu/MenuRouterTest.php b/core/modules/system/src/Tests/Menu/MenuRouterTest.php
index e7328d9..b7b4c5b 100644
--- a/core/modules/system/src/Tests/Menu/MenuRouterTest.php
+++ b/core/modules/system/src/Tests/Menu/MenuRouterTest.php
@@ -205,7 +205,7 @@ protected function doTestExoticPath() {
/**
* Make sure the maintenance mode can be bypassed using an EventSubscriber.
*
- * @see \Drupal\menu_test\EventSubscriber\MaintenanceModeSubscriber::onKernelRequestMaintenance()
+ * @see \Drupal\menu_test\EventSubscriber\MaintenanceModeSubscriber::onKernelRequestMaintenance().
*/
public function testMaintenanceModeLoginPaths() {
$this->container->get('state')->set('system.maintenance_mode', TRUE);
diff --git a/core/modules/system/src/Tests/System/SystemAuthorizeTest.php b/core/modules/system/src/Tests/System/SystemAuthorizeTest.php
index 5e278d7..d82a210 100644
--- a/core/modules/system/src/Tests/System/SystemAuthorizeTest.php
+++ b/core/modules/system/src/Tests/System/SystemAuthorizeTest.php
@@ -34,7 +34,7 @@ protected function setUp() {
* $_SESSION inside the test site, not the framework site. This callback
* redirects to authorize.php when it's done initializing.
*
- * @see system_authorized_init()
+ * @see system_authorized_init().
*/
function drupalGetAuthorizePHP($page_title = 'system-test-auth') {
$this->drupalGet('system-test/authorize-init/' . $page_title);
diff --git a/core/modules/system/src/Tests/TypedData/TypedDataTest.php b/core/modules/system/src/Tests/TypedData/TypedDataTest.php
index 8473485..48a80836 100644
--- a/core/modules/system/src/Tests/TypedData/TypedDataTest.php
+++ b/core/modules/system/src/Tests/TypedData/TypedDataTest.php
@@ -50,7 +50,7 @@ protected function setUp() {
/**
* Creates a typed data object and ensures it implements TypedDataInterface.
*
- * @see \Drupal\Core\TypedData\TypedDataManager::create()
+ * @see \Drupal\Core\TypedData\TypedDataManager::create().
*/
protected function createTypedData($definition, $value = NULL, $name = NULL) {
if (is_array($definition)) {
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 738b52e..813950e 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -1138,7 +1138,7 @@ function system_sort_modules_by_info_name($a, $b) {
* Callback for uasort() within
* \Drupal\system\Controller\SystemController::themesPage().
*
- * @see system_sort_modules_by_info_name()
+ * @see system_sort_modules_by_info_name().
*/
function system_sort_themes($a, $b) {
if ($a->is_default) {
diff --git a/core/modules/system/tests/modules/menu_test/menu_test.module b/core/modules/system/tests/modules/menu_test/menu_test.module
index f891fce..093f3b8 100644
--- a/core/modules/system/tests/modules/menu_test/menu_test.module
+++ b/core/modules/system/tests/modules/menu_test/menu_test.module
@@ -82,7 +82,7 @@ function menu_test_menu_name($new_name = '') {
* @return string
* A string containing the title and case number.
*
- * @see menu_test_menu()
+ * @see menu_test_menu().
*/
function menu_test_title_callback($title, $case_number = 3) {
return t($title) . ' - Case ' . $case_number;
diff --git a/core/modules/system/tests/modules/module_test/module_test.module b/core/modules/system/tests/modules/module_test/module_test.module
index 9c5cd9a..ab5a4fc 100644
--- a/core/modules/system/tests/modules/module_test/module_test.module
+++ b/core/modules/system/tests/modules/module_test/module_test.module
@@ -69,7 +69,7 @@ function module_test_hook_info() {
/**
* Load function used by module_test_hook_dynamic_loading_invoke_all_during_load().
*
- * @see module_test_menu()
+ * @see module_test_menu().
*/
function module_test_load($param) {
$result = \Drupal::moduleHandler()->invokeAll('test_hook');
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 9bf4fae..d22d6eb 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
@@ -242,7 +242,7 @@ public static function preRenderCacheTags($elements) {
/**
* Initialize authorize.php during testing.
*
- * @see system_authorized_init()
+ * @see system_authorized_init().
*/
public function authorizeInit($page_title) {
$authorize_url = Url::fromUri('base:core/authorize.php', array('absolute' => TRUE))->toString();
diff --git a/core/modules/taxonomy/src/Entity/Term.php b/core/modules/taxonomy/src/Entity/Term.php
index 2e41e2d..65386479 100644
--- a/core/modules/taxonomy/src/Entity/Term.php
+++ b/core/modules/taxonomy/src/Entity/Term.php
@@ -101,18 +101,33 @@ public function postSave(EntityStorageInterface $storage, $update = TRUE) {
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
- /** @var \Drupal\Core\Field\BaseFieldDefinition[] $fields */
- $fields = parent::baseFieldDefinitions($entity_type);
-
- $fields['tid']->setLabel(t('Term ID'))
- ->setDescription(t('The term ID.'));
-
- $fields['uuid']->setDescription(t('The term UUID.'));
-
- $fields['vid']->setLabel(t('Vocabulary'))
- ->setDescription(t('The vocabulary to which the term is assigned.'));
-
- $fields['langcode']->setDescription(t('The term language code.'));
+ $fields['tid'] = BaseFieldDefinition::create('integer')
+ ->setLabel(t('Term ID'))
+ ->setDescription(t('The term ID.'))
+ ->setReadOnly(TRUE)
+ ->setSetting('unsigned', TRUE);
+
+ $fields['uuid'] = BaseFieldDefinition::create('uuid')
+ ->setLabel(t('UUID'))
+ ->setDescription(t('The term UUID.'))
+ ->setReadOnly(TRUE);
+
+ $fields['vid'] = BaseFieldDefinition::create('entity_reference')
+ ->setLabel(t('Vocabulary'))
+ ->setDescription(t('The vocabulary to which the term is assigned.'))
+ ->setSetting('target_type', 'taxonomy_vocabulary');
+
+ $fields['langcode'] = BaseFieldDefinition::create('language')
+ ->setLabel(t('Language'))
+ ->setDescription(t('The term language code.'))
+ ->setTranslatable(TRUE)
+ ->setDisplayOptions('view', array(
+ 'type' => 'hidden',
+ ))
+ ->setDisplayOptions('form', array(
+ 'type' => 'language_select',
+ 'weight' => 2,
+ ));
$fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t('Name'))
diff --git a/core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php b/core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php
index 40c8fc7..faa5d70 100644
--- a/core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php
+++ b/core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php
@@ -16,7 +16,7 @@
*
* @ViewsRelationship("node_term_data")
*/
-class NodeTermData extends RelationshipPluginBase {
+class NodeTermData extends RelationshipPluginBase {
/**
* The vocabulary storage.
diff --git a/core/modules/taxonomy/src/TermTranslationHandler.php b/core/modules/taxonomy/src/TermTranslationHandler.php
index 72539b5..76b9691 100644
--- a/core/modules/taxonomy/src/TermTranslationHandler.php
+++ b/core/modules/taxonomy/src/TermTranslationHandler.php
@@ -24,7 +24,7 @@ public function entityFormAlter(array &$form, FormStateInterface $form_state, En
*
* This handles the save action.
*
- * @see \Drupal\Core\Entity\EntityForm::build()
+ * @see \Drupal\Core\Entity\EntityForm::build().
*/
function entityFormSave(array $form, FormStateInterface $form_state) {
if ($this->getSourceLangcode($form_state)) {
diff --git a/core/modules/toolbar/src/Element/Toolbar.php b/core/modules/toolbar/src/Element/Toolbar.php
index 7077372..48e4ddc 100644
--- a/core/modules/toolbar/src/Element/Toolbar.php
+++ b/core/modules/toolbar/src/Element/Toolbar.php
@@ -61,7 +61,7 @@ public function getInfo() {
* @return array
* A renderable array.
*
- * @see toolbar_page_top()
+ * @see toolbar_page_top().
*/
public static function preRenderToolbar($element) {
// Get the configured breakpoints to switch from vertical to horizontal
diff --git a/core/modules/update/src/Form/UpdateManagerInstall.php b/core/modules/update/src/Form/UpdateManagerInstall.php
index f06b53a..5524f9e 100644
--- a/core/modules/update/src/Form/UpdateManagerInstall.php
+++ b/core/modules/update/src/Form/UpdateManagerInstall.php
@@ -122,8 +122,8 @@ public function buildForm(array $form, FormStateInterface $form_state) {
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
- $all_files = $this->getRequest()->files->get('files', []);
- if (!($form_state->getValue('project_url') xor !empty($all_files['project_upload']))) {
+ $uploaded_file = $this->getRequest()->files->get('files[project_upload]', NULL, TRUE);
+ if (!($form_state->getValue('project_url') xor !empty($uploaded_file))) {
$form_state->setErrorByName('project_url', $this->t('You must either provide a URL or upload an archive file to install.'));
}
}
diff --git a/core/modules/user/src/Entity/User.php b/core/modules/user/src/Entity/User.php
index 030b9a9..4896bad 100644
--- a/core/modules/user/src/Entity/User.php
+++ b/core/modules/user/src/Entity/User.php
@@ -425,17 +425,21 @@ public static function getAnonymousUser() {
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
- /** @var \Drupal\Core\Field\BaseFieldDefinition[] $fields */
- $fields = parent::baseFieldDefinitions($entity_type);
-
- $fields['uid']->setLabel(t('User ID'))
- ->setDescription(t('The user ID.'));
-
- $fields['uuid']->setDescription(t('The user UUID.'));
-
- $fields['langcode']->setLabel(t('Language code'))
+ $fields['uid'] = BaseFieldDefinition::create('integer')
+ ->setLabel(t('User ID'))
+ ->setDescription(t('The user ID.'))
+ ->setReadOnly(TRUE)
+ ->setSetting('unsigned', TRUE);
+
+ $fields['uuid'] = BaseFieldDefinition::create('uuid')
+ ->setLabel(t('UUID'))
+ ->setDescription(t('The user UUID.'))
+ ->setReadOnly(TRUE);
+
+ $fields['langcode'] = BaseFieldDefinition::create('language')
+ ->setLabel(t('Language code'))
->setDescription(t('The user language code.'))
- ->setDisplayOptions('form', ['type' => 'hidden']);
+ ->setTranslatable(TRUE);
$fields['preferred_langcode'] = BaseFieldDefinition::create('language')
->setLabel(t('Preferred language code'))
diff --git a/core/modules/user/src/Plugin/views/filter/Name.php b/core/modules/user/src/Plugin/views/filter/Name.php
index d31c781..7554adf 100644
--- a/core/modules/user/src/Plugin/views/filter/Name.php
+++ b/core/modules/user/src/Plugin/views/filter/Name.php
@@ -28,7 +28,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) {
'#target_type' => 'user',
'#tags' => TRUE,
'#default_value' => $default_value,
- '#process_default_value' => $this->isExposed(),
+ '#process_default_value' => FALSE,
);
$user_input = $form_state->getUserInput();
diff --git a/core/modules/user/src/ProfileTranslationHandler.php b/core/modules/user/src/ProfileTranslationHandler.php
index d981f99..6da69cd 100644
--- a/core/modules/user/src/ProfileTranslationHandler.php
+++ b/core/modules/user/src/ProfileTranslationHandler.php
@@ -40,7 +40,7 @@ public function entityFormAlter(array &$form, FormStateInterface $form_state, En
*
* This handles the save action.
*
- * @see \Drupal\Core\Entity\EntityForm::build()
+ * @see \Drupal\Core\Entity\EntityForm::build().
*/
public function entityFormSave(array $form, FormStateInterface $form_state) {
if ($this->getSourceLangcode($form_state)) {
diff --git a/core/modules/user/src/Tests/Views/HandlerFilterUserNameTest.php b/core/modules/user/src/Tests/Views/HandlerFilterUserNameTest.php
index eaf24aa..e0cba5e 100644
--- a/core/modules/user/src/Tests/Views/HandlerFilterUserNameTest.php
+++ b/core/modules/user/src/Tests/Views/HandlerFilterUserNameTest.php
@@ -137,17 +137,6 @@ public function testExposedFilter() {
$this->drupalGet($path, $options);
$this->assertRaw(t('There are no entities matching "%value".', array('%value' => implode(', ', $users))));
- // Pass in an invalid target_id in for the entity_autocomplete value format.
- // There should be no errors, but all results should be returned as the
- // default value for the autocomplete will not match any users so should
- // be empty.
- $options['query']['uid'] = [['target_id' => 9999]];
- $this->drupalGet($path, $options);
- // The actual result should contain all of the user ids.
- foreach ($this->accounts as $account) {
- $this->assertRaw($account->id());
- }
-
// Pass in an invalid username and a valid username.
$users = array($this->randomMachineName(), $this->names[0]);
$users = array_map('strtolower', $users);
@@ -167,18 +156,6 @@ public function testExposedFilter() {
foreach ($this->accounts as $account) {
$this->assertRaw($account->id());
}
-
- // Pass in just valid user IDs in the entity_autocomplete target_id format.
- $options['query']['uid'] = array_map(function($account) {
- return ['target_id' => $account->id()];
- }, $this->accounts);
-
- $this->drupalGet($path, $options);
- $this->assertNoRaw('Unable to find user');
- // The actual result should contain all of the user ids.
- foreach ($this->accounts as $account) {
- $this->assertRaw($account->id());
- }
}
}
diff --git a/core/modules/user/src/UserInterface.php b/core/modules/user/src/UserInterface.php
index 1aea757..74baa70 100644
--- a/core/modules/user/src/UserInterface.php
+++ b/core/modules/user/src/UserInterface.php
@@ -180,7 +180,7 @@ public function setExistingPassword($password);
* @return bool
* TRUE if the correct existing password was provided.
*
- * @see UserInterface::setExistingPassword()
+ * @see UserInterface::setExistingPassword().
*/
public function checkExistingPassword(UserInterface $account_unchanged);
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index 1e84fa9..12adb4a 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -984,7 +984,7 @@ function user_user_role_insert(RoleInterface $role) {
}
$add_id = 'user_add_role_action.' . $role->id();
- if (!Action::load($add_id)) {
+ if (!entity_load('action', $add_id)) {
$action = Action::create(array(
'id' => $add_id,
'type' => 'user',
@@ -997,7 +997,7 @@ function user_user_role_insert(RoleInterface $role) {
$action->trustData()->save();
}
$remove_id = 'user_remove_role_action.' . $role->id();
- if (!Action::load($remove_id)) {
+ if (!entity_load('action', $remove_id)) {
$action = Action::create(array(
'id' => $remove_id,
'type' => 'user',
@@ -1024,10 +1024,10 @@ function user_user_role_delete(RoleInterface $role) {
return;
}
- $actions = Action::loadMultiple([
+ $actions = entity_load_multiple('action', array(
'user_add_role_action.' . $role->id(),
'user_remove_role_action.' . $role->id(),
- ]);
+ ));
foreach ($actions as $action) {
$action->delete();
}
diff --git a/core/modules/views/src/Plugin/views/BrokenHandlerTrait.php b/core/modules/views/src/Plugin/views/BrokenHandlerTrait.php
index df129da..feac173 100644
--- a/core/modules/views/src/Plugin/views/BrokenHandlerTrait.php
+++ b/core/modules/views/src/Plugin/views/BrokenHandlerTrait.php
@@ -13,7 +13,7 @@
/**
* Returns this handlers name in the UI.
*
- * @see \Drupal\views\Plugin\views\PluginBase::defineOptions()
+ * @see \Drupal\views\Plugin\views\PluginBase::defineOptions().
*/
public function adminLabel($short = FALSE) {
return t('Broken/missing handler');
@@ -22,7 +22,7 @@ public function adminLabel($short = FALSE) {
/**
* The option definition for this handler.
*
- * @see \Drupal\views\Plugin\views\PluginBase::defineOptions()
+ * @see \Drupal\views\Plugin\views\PluginBase::defineOptions().
*/
public function defineOptions() {
return array();
@@ -32,7 +32,7 @@ public function defineOptions() {
* Ensure the main table for this handler is in the query. This is used
* a lot.
*
- * @see \Drupal\views\Plugin\views\HandlerBase::ensureMyTable()
+ * @see \Drupal\views\Plugin\views\HandlerBase::ensureMyTable().
*/
public function ensureMyTable() {
// No table to ensure.
@@ -48,7 +48,7 @@ public function query($group_by = FALSE) {
/**
* Provides a form to edit options for this plugin.
*
- * @see \Drupal\views\Plugin\views\PluginBase::defineOptions()
+ * @see \Drupal\views\Plugin\views\PluginBase::defineOptions().
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$description_top = t('The handler for this item is broken or missing. The following details are available:');
@@ -84,7 +84,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
*
* This means it's a placeholder used when a handler can't be found.
*
- * @see \Drupal\views\Plugin\views\HandlerBase::broken()
+ * @see \Drupal\views\Plugin\views\HandlerBase::broken().
*/
public function broken() {
return TRUE;
@@ -95,7 +95,7 @@ public function broken() {
*
* @return array
*
- * @see \Drupal\views\Plugin\views\PluginBase::calculateDependencies()
+ * @see \Drupal\views\Plugin\views\PluginBase::calculateDependencies().
*/
public function calculateDependencies() {
return [];
diff --git a/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php b/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
index 7abd1df..d0ae5eb 100644
--- a/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
+++ b/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
@@ -1206,7 +1206,7 @@ public static function preRenderMoveArgumentOptions($form) {
* @return string
* The sanitized identifier.
*
- * @see decodeValidatorId()
+ * @see decodeValidatorId().
*/
public static function encodeValidatorId($id) {
return str_replace(':', '---', $id);
diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
index 102718d..193e20b 100644
--- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
+++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
@@ -2217,10 +2217,6 @@ public function renderArea($area, $empty = FALSE) {
$return = array();
foreach ($this->getHandlers($area) as $key => $area_handler) {
if ($area_render = $area_handler->render($empty)) {
- if (isset($area_handler->position)) {
- // Fix weight of area.
- $area_render['#weight'] = $area_handler->position;
- }
$return[$key] = $area_render;
}
}
diff --git a/core/modules/views/src/Plugin/views/field/Field.php b/core/modules/views/src/Plugin/views/field/Field.php
index 35dcb64..6d318c4 100644
--- a/core/modules/views/src/Plugin/views/field/Field.php
+++ b/core/modules/views/src/Plugin/views/field/Field.php
@@ -1030,27 +1030,15 @@ public function getValue(ResultRow $values, $field = NULL) {
$field_item_definition = $field_item_list->getFieldDefinition();
- $values = [];
- foreach ($field_item_list as $field_item) {
- /** @var \Drupal\Core\Field\FieldItemInterface $field_item */
- if ($field) {
- $values[] = $field_item->$field;
- }
- // Find the value using the main property of the field. If no main
- // property is provided fall back to 'value'.
- elseif ($main_property_name = $field_item->mainPropertyName()) {
- $values[] = $field_item->{$main_property_name};
- }
- else {
- $values[] = $field_item->value;
- }
- }
if ($field_item_definition->getFieldStorageDefinition()->getCardinality() == 1) {
- return reset($values);
+ return $field ? $field_item_list->$field : $field_item_list->value;
}
- else {
- return $values;
+
+ $values = [];
+ foreach ($field_item_list as $field_item) {
+ $values[] = $field ? $field_item->$field : $field_item->value;
}
+ return $values;
}
}
diff --git a/core/modules/views/src/Plugin/views/query/QueryPluginBase.php b/core/modules/views/src/Plugin/views/query/QueryPluginBase.php
index e896660..5dfa0a0 100644
--- a/core/modules/views/src/Plugin/views/query/QueryPluginBase.php
+++ b/core/modules/views/src/Plugin/views/query/QueryPluginBase.php
@@ -160,7 +160,7 @@ public function getLimit() {
* @param $where
* 'where' or 'having'.
*
- * @return
+ * @return $group
* The group ID generated.
*/
public function setWhereGroup($type = 'AND', $group = NULL, $where = 'where') {
diff --git a/core/modules/views/src/Plugin/views/query/Sql.php b/core/modules/views/src/Plugin/views/query/Sql.php
index cfe593c..43b4a44 100644
--- a/core/modules/views/src/Plugin/views/query/Sql.php
+++ b/core/modules/views/src/Plugin/views/query/Sql.php
@@ -5,7 +5,6 @@
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Database\Database;
-use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\Core\Database\DatabaseExceptionWrapper;
@@ -14,7 +13,6 @@
use Drupal\views\ResultRow;
use Drupal\views\ViewExecutable;
use Drupal\views\Views;
-use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Views query plugin for an SQL query.
@@ -109,40 +107,6 @@ class Sql extends QueryPluginBase {
protected $noDistinct;
/**
- * The entity type manager.
- *
- * @var \Drupal\Core\Entity\EntityTypeManagerInterface
- */
- protected $entityTypeManager;
-
- /**
- * Constructs a Sql object.
- *
- * @param array $configuration
- * A configuration array containing information about the plugin instance.
- * @param string $plugin_id
- * The plugin_id for the plugin instance.
- * @param mixed $plugin_definition
- * The plugin implementation definition.
- * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
- * The entity type manager.
- */
- public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager) {
- parent::__construct($configuration, $plugin_id, $plugin_definition);
-
- $this->entityTypeManager = $entity_type_manager;
- }
-
- public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
- return new static(
- $configuration,
- $plugin_id,
- $plugin_definition,
- $container->get('entity_type.manager')
- );
- }
-
- /**
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
@@ -373,7 +337,7 @@ public function addRelationship($alias, JoinPluginBase $join, $base, $link_point
* @param $alias
* A specific alias to use, rather than the default alias.
*
- * @return string
+ * @return $alias
* The alias of the table; this alias can be used to access information
* about the table and should always be used to refer to the table when
* adding parts to the query. Or FALSE if the table was not able to be
@@ -412,7 +376,7 @@ public function addTable($table, $relationship = NULL, JoinPluginBase $join = NU
* @param $alias
* A specific alias to use, rather than the default alias.
*
- * @return string
+ * @return $alias
* The alias of the table; this alias can be used to access information
* about the table and should always be used to refer to the table when
* adding parts to the query. Or FALSE if the table was not able to be
@@ -759,7 +723,7 @@ public function getTableInfo($table) {
* - aggregate: Set to TRUE to indicate that this value should be
* aggregated in a GROUP BY.
*
- * @return string
+ * @return $name
* The name that this field can be referred to as. Usually this is the alias.
*/
public function addField($table, $field, $alias = '', $params = array()) {
@@ -1518,97 +1482,63 @@ public function loadEntities(&$results) {
foreach ($entity_information as $info) {
$entity_type = $info['entity_type'];
if (!isset($entity_types[$entity_type])) {
- $entity_types[$entity_type] = $this->entityTypeManager->getDefinition($entity_type);
+ $entity_types[$entity_type] = \Drupal::entityManager()->getDefinition($entity_type);
}
}
// Assemble a list of entities to load.
- $entity_ids_by_type = [];
- $revision_ids_by_type = [];
+ $ids_by_type = array();
foreach ($entity_information as $info) {
$relationship_id = $info['relationship_id'];
$entity_type = $info['entity_type'];
- /** @var \Drupal\Core\Entity\EntityTypeInterface $entity_info */
$entity_info = $entity_types[$entity_type];
- $revision = $info['revision'];
- $id_key = !$revision ? $entity_info->getKey('id') : $entity_info->getKey('revision');
+ $id_key = !$info['revision'] ? $entity_info->getKey('id') : $entity_info->getKey('revision');
$id_alias = $this->getFieldAlias($info['alias'], $id_key);
foreach ($results as $index => $result) {
// Store the entity id if it was found.
if (isset($result->{$id_alias}) && $result->{$id_alias} != '') {
- if ($revision) {
- $revision_ids_by_type[$entity_type][$index][$relationship_id] = $result->$id_alias;
- }
- else {
- $entity_ids_by_type[$entity_type][$index][$relationship_id] = $result->$id_alias;
- }
+ $ids_by_type[$entity_type][$index][$relationship_id] = $result->$id_alias;
}
}
}
// Load all entities and assign them to the correct result row.
- foreach ($entity_ids_by_type as $entity_type => $ids) {
- $entity_storage = $this->entityTypeManager->getStorage($entity_type);
+ foreach ($ids_by_type as $entity_type => $ids) {
$flat_ids = iterator_to_array(new \RecursiveIteratorIterator(new \RecursiveArrayIterator($ids)), FALSE);
- $entities = $entity_storage->loadMultiple(array_unique($flat_ids));
- $results = $this->assignEntitiesToResult($ids, $entities, $results);
- }
-
- // Now load all revisions.
- foreach ($revision_ids_by_type as $entity_type => $revision_ids) {
- $entity_storage = $this->entityTypeManager->getStorage($entity_type);
- $entities = [];
-
- foreach ($revision_ids as $index => $revision_id_by_relationship) {
- foreach ($revision_id_by_relationship as $revision => $revision_id) {
- // Drupal core currently has no way to load multiple revisions.
- $entity = $entity_storage->loadRevision($revision_id);
- $entities[$revision_id] = $entity;
+ // Drupal core currently has no way to load multiple revisions. Sad.
+ if (isset($entity_information[$entity_type]['revision']) && $entity_information[$entity_type]['revision'] === TRUE) {
+ $entities = array();
+ foreach ($flat_ids as $revision_id) {
+ $entity = entity_revision_load($entity_type, $revision_id);
+ if ($entity) {
+ $entities[$revision_id] = $entity;
+ }
}
}
+ else {
+ $entities = entity_load_multiple($entity_type, $flat_ids);
+ }
- $results = $this->assignEntitiesToResult($revision_ids, $entities, $results);
- }
- }
-
- /**
- * Sets entities onto the view result row objects.
- *
- * This method takes into account the relationship in which the entity was
- * needed in the first place.
- *
- * @param mixed[][] $ids
- * A two dimensional array of identifiers (entity ID / revision ID) keyed by
- * relationship.
- * @param \Drupal\Core\Entity\EntityInterface[] $entities
- * An array of entities keyed by their identified (entity ID / revision ID).
- * @param \Drupal\views\ResultRow[] $results
- * The entire views result.
- *
- * @return \Drupal\views\ResultRow[]
- * The changed views results.
- */
- protected function assignEntitiesToResult($ids, array $entities, array $results) {
- foreach ($ids as $index => $relationships) {
- foreach ($relationships as $relationship_id => $id) {
- if (isset($entities[$id])) {
- $entity = $entities[$id];
- }
- else {
- $entity = NULL;
- }
+ foreach ($ids as $index => $relationships) {
+ foreach ($relationships as $relationship_id => $entity_id) {
+ if (isset($entities[$entity_id])) {
+ $entity = $entities[$entity_id];
+ }
+ else {
+ $entity = NULL;
+ }
- if ($relationship_id == 'none') {
- $results[$index]->_entity = $entity;
- }
- else {
- $results[$index]->_relationship_entities[$relationship_id] = $entity;
+ if ($relationship_id == 'none') {
+ $results[$index]->_entity = $entity;
+ }
+ else {
+ $results[$index]->_relationship_entities[$relationship_id] = $entity;
+ }
}
}
}
- return $results;
}
/**
diff --git a/core/modules/views/src/Plugin/views/relationship/EntityReverse.php b/core/modules/views/src/Plugin/views/relationship/EntityReverse.php
index 42d6fa1..c1b8821 100644
--- a/core/modules/views/src/Plugin/views/relationship/EntityReverse.php
+++ b/core/modules/views/src/Plugin/views/relationship/EntityReverse.php
@@ -13,7 +13,7 @@
*
* @ViewsRelationship("entity_reverse")
*/
-class EntityReverse extends RelationshipPluginBase {
+class EntityReverse extends RelationshipPluginBase {
/**
* Constructs an EntityReverse object.
diff --git a/core/modules/views/src/Tests/Entity/FieldEntityTranslationTest.php b/core/modules/views/src/Tests/Entity/FieldEntityTranslationTest.php
index eed7193..12c59e4 100644
--- a/core/modules/views/src/Tests/Entity/FieldEntityTranslationTest.php
+++ b/core/modules/views/src/Tests/Entity/FieldEntityTranslationTest.php
@@ -7,7 +7,7 @@
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\views\Tests\ViewTestBase;
-use Symfony\Component\CssSelector\CssSelectorConverter;
+use Symfony\Component\CssSelector\CssSelector;
/**
* Tests the rendering of fields (base fields) and their translations.
@@ -171,8 +171,8 @@ protected function assertRows($expected = []) {
$rows = $this->cssSelect('div.views-row');
foreach ($rows as $row) {
$actual[] = [
- 'title' => (string) $row->xpath((new CssSelectorConverter())->toXPath('.views-field-title span.field-content a'))[0],
- 'sticky' => (string) $row->xpath((new CssSelectorConverter())->toXPath('.views-field-sticky span.field-content'))[0],
+ 'title' => (string) $row->xpath(CssSelector::toXPath('.views-field-title span.field-content a'))[0],
+ 'sticky' => (string) $row->xpath(CssSelector::toXPath('.views-field-sticky span.field-content'))[0],
];
}
$this->assertEqual($actual, $expected);
diff --git a/core/modules/views/src/Tests/TestHelperPlugin.php b/core/modules/views/src/Tests/TestHelperPlugin.php
index 8656063..aff3607 100644
--- a/core/modules/views/src/Tests/TestHelperPlugin.php
+++ b/core/modules/views/src/Tests/TestHelperPlugin.php
@@ -21,7 +21,7 @@ class TestHelperPlugin extends PluginBase {
/**
* Calls the protected method setOptionDefaults().
*
- * @see \Drupal\views\Plugin\views\PluginBase::setOptionDefaults()
+ * @see \Drupal\views\Plugin\views\PluginBase::setOptionDefaults().
*/
public function testSetOptionDefaults(&$storage, $options, $level = 0) {
$this->setOptionDefaults($storage, $options, $level);
diff --git a/core/modules/views/src/Tests/Wizard/BasicTest.php b/core/modules/views/src/Tests/Wizard/BasicTest.php
index aa4fc34..e558cde 100644
--- a/core/modules/views/src/Tests/Wizard/BasicTest.php
+++ b/core/modules/views/src/Tests/Wizard/BasicTest.php
@@ -193,7 +193,7 @@ public function testWizardForm() {
/**
* Tests default plugin values are populated from the wizard form.
*
- * @see \Drupal\views\Plugin\views\display\DisplayPluginBase::mergeDefaults()
+ * @see \Drupal\views\Plugin\views\display\DisplayPluginBase::mergeDefaults().
*/
public function testWizardDefaultValues() {
$random_id = strtolower($this->randomMachineName(16));
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.base_and_revision.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.base_and_revision.yml
deleted file mode 100644
index d7d6162..0000000
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.base_and_revision.yml
+++ /dev/null
@@ -1,346 +0,0 @@
-langcode: en
-status: true
-dependencies:
- module:
- - node
- - user
-id: base_and_revision
-label: base_and_revision
-module: views
-description: ''
-tag: ''
-base_table: node_field_revision
-base_field: vid
-core: 8.x
-display:
- default:
- display_plugin: default
- id: default
- display_title: Master
- position: 0
- display_options:
- access:
- type: perm
- options:
- perm: 'view all revisions'
- 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: mini
- 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: ‹‹
- next: ››
- 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:
- nid:
- id: nid
- table: node_field_revision
- field: nid
- relationship: none
- group_type: group
- admin_label: ''
- label: ''
- exclude: false
- alter:
- alter_text: false
- text: ''
- make_link: false
- path: ''
- absolute: false
- external: false
- replace_spaces: false
- path_case: none
- trim_whitespace: false
- alt: ''
- rel: ''
- link_class: ''
- prefix: ''
- suffix: ''
- target: ''
- nl2br: false
- max_length: 0
- word_boundary: true
- ellipsis: true
- more_link: false
- more_link_text: ''
- more_link_path: ''
- strip_tags: false
- trim: false
- preserve_tags: ''
- html: false
- element_type: ''
- element_class: ''
- element_label_type: ''
- element_label_class: ''
- element_label_colon: false
- element_wrapper_type: ''
- element_wrapper_class: ''
- element_default_classes: true
- empty: ''
- hide_empty: false
- empty_zero: false
- hide_alter_empty: true
- click_sort_column: value
- type: number_integer
- settings:
- thousand_separator: ''
- prefix_suffix: true
- group_column: value
- group_columns: { }
- group_rows: true
- delta_limit: 0
- delta_offset: 0
- delta_reversed: false
- delta_first_last: false
- multi_type: separator
- separator: ', '
- field_api_classes: false
- entity_type: node
- entity_field: nid
- plugin_id: field
- vid:
- id: vid
- table: node_field_revision
- field: vid
- relationship: none
- group_type: group
- admin_label: ''
- label: ''
- exclude: false
- alter:
- alter_text: false
- text: ''
- make_link: false
- path: ''
- absolute: false
- external: false
- replace_spaces: false
- path_case: none
- trim_whitespace: false
- alt: ''
- rel: ''
- link_class: ''
- prefix: ''
- suffix: ''
- target: ''
- nl2br: false
- max_length: 0
- word_boundary: true
- ellipsis: true
- more_link: false
- more_link_text: ''
- more_link_path: ''
- strip_tags: false
- trim: false
- preserve_tags: ''
- html: false
- element_type: ''
- element_class: ''
- element_label_type: ''
- element_label_class: ''
- element_label_colon: false
- element_wrapper_type: ''
- element_wrapper_class: ''
- element_default_classes: true
- empty: ''
- hide_empty: false
- empty_zero: false
- hide_alter_empty: true
- click_sort_column: value
- type: number_integer
- settings:
- thousand_separator: ''
- prefix_suffix: true
- group_column: value
- group_columns: { }
- group_rows: true
- delta_limit: 0
- delta_offset: 0
- delta_reversed: false
- delta_first_last: false
- multi_type: separator
- separator: ', '
- field_api_classes: false
- entity_type: node
- entity_field: vid
- plugin_id: field
- vid_1:
- id: vid_1
- table: node_field_data
- field: vid
- relationship: nid
- group_type: group
- admin_label: ''
- label: ''
- exclude: false
- alter:
- alter_text: false
- text: ''
- make_link: false
- path: ''
- absolute: false
- external: false
- replace_spaces: false
- path_case: none
- trim_whitespace: false
- alt: ''
- rel: ''
- link_class: ''
- prefix: ''
- suffix: ''
- target: ''
- nl2br: false
- max_length: 0
- word_boundary: true
- ellipsis: true
- more_link: false
- more_link_text: ''
- more_link_path: ''
- strip_tags: false
- trim: false
- preserve_tags: ''
- html: false
- element_type: ''
- element_class: ''
- element_label_type: ''
- element_label_class: ''
- element_label_colon: false
- element_wrapper_type: ''
- element_wrapper_class: ''
- element_default_classes: true
- empty: ''
- hide_empty: false
- empty_zero: false
- hide_alter_empty: true
- click_sort_column: value
- type: number_integer
- settings:
- thousand_separator: ''
- prefix_suffix: true
- group_column: value
- group_columns: { }
- group_rows: true
- delta_limit: 0
- delta_offset: 0
- delta_reversed: false
- delta_first_last: false
- multi_type: separator
- separator: ', '
- field_api_classes: false
- entity_type: node
- entity_field: vid
- plugin_id: field
- filters:
- vid:
- id: vid
- table: node_field_revision
- field: vid
- relationship: none
- group_type: group
- admin_label: ''
- operator: '='
- value:
- min: ''
- max: ''
- value: '3'
- group: 1
- exposed: false
- expose:
- operator_id: ''
- label: ''
- description: ''
- use_operator: false
- operator: ''
- identifier: ''
- required: false
- remember: false
- multiple: false
- remember_roles:
- authenticated: authenticated
- is_grouped: false
- group_info:
- label: ''
- description: ''
- identifier: ''
- optional: true
- widget: select
- multiple: false
- remember: false
- default_group: All
- default_group_multiple: { }
- group_items: { }
- entity_type: node
- entity_field: vid
- plugin_id: numeric
- sorts: { }
- header: { }
- footer: { }
- empty: { }
- relationships:
- nid:
- id: nid
- table: node_field_revision
- field: nid
- relationship: none
- group_type: group
- admin_label: Node
- required: false
- entity_type: node
- entity_field: nid
- plugin_id: standard
- arguments: { }
- display_extenders: { }
- rendering_language: en
- cache_metadata:
- max-age: -1
- contexts:
- - 'languages:language_interface'
- - url.query_args
- - 'user.node_grants:view'
- - user.permissions
- tags: { }
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_area_order.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_area_order.yml
deleted file mode 100644
index 3a562df..0000000
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_area_order.yml
+++ /dev/null
@@ -1,53 +0,0 @@
-langcode: en
-status: true
-id: test_area_order
-label: ''
-module: views
-description: ''
-tag: ''
-base_table: views_test_data
-base_field: nid
-core: '8'
-display:
- default:
- display_options:
- defaults:
- fields: false
- pager: false
- sorts: false
- header:
- entity_block_2:
- field: entity_block
- id: entity_block
- table: views
- target: 'bartik_powered'
- view_mode: full
- plugin_id: entity
- entity_block_1:
- field: entity_block
- id: entity_block
- table: views
- target: 'bartik_branding'
- view_mode: full
- plugin_id: entity
- fields:
- id:
- field: id
- id: id
- relationship: none
- table: views_test_data
- plugin_id: numeric
- arguments:
- id:
- id: id
- table: views_test_data
- field: id
- plugin_id: numeric
- pager:
- options:
- offset: 0
- type: none
- display_plugin: default
- display_title: Master
- id: default
- position: 0
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_field_test.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_field_test.yml
index eabb8f2..1c65762 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_field_test.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_field_test.yml
@@ -23,13 +23,6 @@ display:
plugin_id: field
entity_type: entity_test
entity_field: id
- field_test_multiple:
- id: field_test_multiple
- table: entity_test__field_test_multiple
- field: field_test_multiple
- plugin_id: field
- entity_type: entity_test
- entity_field: field_test_multiple
field_test:
id: field_test
table: entity_test__field_test
@@ -37,13 +30,6 @@ display:
plugin_id: field
entity_type: entity_test
entity_field: field_test
- user_id:
- id: user_id
- table: entity_test
- field: user_id
- plugin_id: field
- entity_type: entity_test
- entity_field: user_id
style:
type: html_list
sorts:
diff --git a/core/modules/views/tests/src/Kernel/Handler/AreaOrderTest.php b/core/modules/views/tests/src/Kernel/Handler/AreaOrderTest.php
deleted file mode 100644
index 457c635..0000000
--- a/core/modules/views/tests/src/Kernel/Handler/AreaOrderTest.php
+++ /dev/null
@@ -1,76 +0,0 @@
- 'bartik_branding',
- 'theme' => 'bartik',
- 'plugin' => 'system_branding_block',
- 'weight' => 1,
- ]
- )->save();
-
- Block::create(
- [
- 'id' => 'bartik_powered',
- 'theme' => 'bartik',
- 'plugin' => 'system_powered_by_block',
- 'weight' => 2,
- ]
- )->save();
-
- parent::setUpFixtures();
- }
-
- /**
- * Tests the order of the handlers.
- */
- public function testAreaOrder() {
- $renderer = $this->container->get('renderer');
- $view = Views::getView('test_area_order');
- $renderable = $view->buildRenderable();
- $output = $this->render($renderable);
-
- $position_powered = strpos($output, 'block-bartik-powered');
- $position_branding = strpos($output, 'block-bartik-branding');
-
- $this->assertNotEquals(0, $position_powered, 'ID bartik-powered found.');
- $this->assertNotEquals(0, $position_branding, 'ID bartik-branding found');
-
- // Make sure "powered" is before "branding", so it reflects the position
- // in the configuration, and not the weight of the blocks.
- $this->assertTrue($position_powered < $position_branding, 'Block bartik-powered is positioned before block bartik-branding');
- }
-
-}
diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php b/core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php
index 1a9df82..8c32dc6 100644
--- a/core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php
+++ b/core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php
@@ -10,7 +10,6 @@
use Drupal\user\Entity\User;
use Drupal\views\Plugin\views\field\Field;
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
-use Drupal\views\Tests\ViewTestData;
use Drupal\views\Views;
/**
@@ -63,15 +62,12 @@ class FieldFieldTest extends ViewsKernelTestBase {
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE) {
- // First setup the needed entity types before installing the views.
- parent::setUp(FALSE);
+ parent::setUp();
- $this->installEntitySchema('user');
$this->installEntitySchema('entity_test');
+ $this->installEntitySchema('user');
$this->installEntitySchema('entity_test_rev');
- ViewTestData::createTestViews(get_class($this), array('views_test_config'));
-
// Bypass any field access.
$this->adminUser = User::create(['name' => $this->randomString()]);
$this->adminUser->save();
@@ -550,60 +546,4 @@ public function testMissingBundleFieldRender() {
$this->assertEqual('', $executable->getStyle()->getField(6, 'field_test'));
}
- /**
- * Tests \Drupal\views\Plugin\views\field\Field::getValue
- */
- public function testGetValueMethod() {
- $bundle = 'test_bundle';
- entity_test_create_bundle($bundle);
-
- $field_multiple = FieldConfig::create([
- 'field_name' => 'field_test_multiple',
- 'entity_type' => 'entity_test',
- 'bundle' => 'test_bundle',
- ]);
- $field_multiple->save();
-
- foreach ($this->entities as $entity) {
- $entity->delete();
- }
-
- $this->entities = [];
- $this->entities[] = $entity = EntityTest::create([
- 'type' => 'entity_test',
- 'name' => 'test name',
- 'user_id' => $this->testUsers[0]->id(),
- ]);
- $entity->save();
- $this->entities[] = $entity = EntityTest::create([
- 'type' => 'entity_test',
- 'name' => 'test name 2',
- 'user_id' => $this->testUsers[0]->id(),
- ]);
- $entity->save();
-
- $this->entities[] = $entity = EntityTest::create([
- 'type' => $bundle,
- 'name' => 'test name 3',
- 'user_id' => $this->testUsers[0]->id(),
- 'field_test_multiple' => [1, 2, 3],
- ]);
- $entity->save();
-
- $executable = Views::getView('test_field_field_test');
- $executable->execute();
-
- $field_normal = $executable->field['field_test'];
- $field_entity_reference = $executable->field['user_id'];
- $field_multi_cardinality = $executable->field['field_test_multiple'];
-
- $this->assertEquals($this->entities[0]->field_test->value, $field_normal->getValue($executable->result[0]));
- $this->assertEquals($this->entities[0]->user_id->target_id, $field_entity_reference->getValue($executable->result[0]));
- $this->assertEquals($this->entities[1]->field_test->value, $field_normal->getValue($executable->result[1]));
- $this->assertEquals($this->entities[1]->user_id->target_id, $field_entity_reference->getValue($executable->result[1]));
- $this->assertEquals([], $field_multi_cardinality->getValue($executable->result[0]));
- $this->assertEquals([], $field_multi_cardinality->getValue($executable->result[1]));
- $this->assertEquals([1, 2, 3], $field_multi_cardinality->getValue($executable->result[2]));
- }
-
}
diff --git a/core/modules/views/tests/src/Kernel/Plugin/SqlEntityLoadingTest.php b/core/modules/views/tests/src/Kernel/Plugin/SqlEntityLoadingTest.php
deleted file mode 100644
index 339638c..0000000
--- a/core/modules/views/tests/src/Kernel/Plugin/SqlEntityLoadingTest.php
+++ /dev/null
@@ -1,83 +0,0 @@
-installEntitySchema('node');
- $this->installEntitySchema('user');
- $this->installSchema('node', 'node_access');
- }
-
- public function testViewWithNonDefaultForwardRevision() {
- $node_type = NodeType::create([
- 'type' => 'page',
- ]);
- $node_type->save();
-
- $node = Node::create([
- 'type' => 'page',
- 'title' => 'test title',
- ]);
- $node->save();
-
- // Creates the first revision, which is set as default.
- $revision = clone $node;
- $revision->setNewRevision(TRUE);
- $revision->isDefaultRevision(TRUE);
- $revision->save();
-
- // Creates the second revision, which is not set as default.
- $revision2 = clone $node;
- $revision2->setNewRevision(TRUE);
- $revision2->isDefaultRevision(FALSE);
- $revision2->save();
-
- $view = Views::getView('base_and_revision');
- $view->execute();
-
- $expected = [
- [
- 'nid' => $node->id(),
- // The default revision ID.
- 'vid_1' => $revision->getRevisionId(),
- // THe latest revision ID.
- 'vid' => $revision2->getRevisionId(),
- ],
- ];
- $this->assertIdenticalResultset($view, $expected, [
- 'node_field_data_node_field_revision_nid' => 'nid',
- 'vid_1' => 'vid_1',
- 'vid' => 'vid',
- ]);
- }
-
-}
diff --git a/core/modules/views/tests/src/Kernel/Plugin/ViewsBlockTest.php b/core/modules/views/tests/src/Kernel/Plugin/ViewsBlockTest.php
index f30db33..9487e3d 100644
--- a/core/modules/views/tests/src/Kernel/Plugin/ViewsBlockTest.php
+++ b/core/modules/views/tests/src/Kernel/Plugin/ViewsBlockTest.php
@@ -39,7 +39,7 @@ protected function setUp($import_test_views = TRUE) {
/**
* Tests that ViewsBlock::getMachineNameSuggestion() produces the right value.
*
- * @see \Drupal\views\Plugin\Block::getmachineNameSuggestion()
+ * @see \Drupal\views\Plugin\Block::getmachineNameSuggestion().
*/
public function testMachineNameSuggestion() {
$plugin_definition = array(
diff --git a/core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php b/core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php
index 4958846..ae06eaf 100644
--- a/core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php
@@ -2,18 +2,9 @@
namespace Drupal\Tests\views\Unit\Plugin\query;
-use Drupal\Core\Entity\EntityInterface;
-use Drupal\Core\Entity\EntityStorageInterface;
-use Drupal\Core\Entity\EntityType;
-use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Tests\UnitTestCase;
use Drupal\views\Plugin\views\query\Sql;
-use Drupal\views\Plugin\views\relationship\RelationshipPluginBase;
use Drupal\views\ResultRow;
-use Drupal\views\ViewEntityInterface;
-use Drupal\views\ViewExecutable;
-use Drupal\views\ViewsData;
-use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* @coversDefaultClass \Drupal\views\Plugin\views\query\Sql
@@ -28,9 +19,8 @@ class SqlTest extends UnitTestCase {
*/
public function testGetCacheTags() {
$view = $this->prophesize('Drupal\views\ViewExecutable')->reveal();
- $entity_type_manager = $this->prophesize(EntityTypeManagerInterface::class);
- $query = new Sql([], 'sql', [], $entity_type_manager->reveal());
+ $query = new Sql([], 'sql', []);
$query->view = $view;
$result = [];
@@ -74,9 +64,8 @@ public function testGetCacheTags() {
*/
public function testGetCacheMaxAge() {
$view = $this->prophesize('Drupal\views\ViewExecutable')->reveal();
- $entity_type_manager = $this->prophesize(EntityTypeManagerInterface::class);
- $query = new Sql([], 'sql', [], $entity_type_manager->reveal());
+ $query = new Sql([], 'sql', []);
$query->view = $view;
$view->result = [];
@@ -109,427 +98,4 @@ public function testGetCacheMaxAge() {
$this->assertEquals(10, $query->getCacheMaxAge());
}
- /**
- * Sets up the views data in the container.
- *
- * @param \Drupal\views\ViewsData $views_data
- * The views data.
- */
- protected function setupViewsData(ViewsData $views_data) {
- $container = \Drupal::hasContainer() ? \Drupal::getContainer() : new ContainerBuilder();
- $container->set('views.views_data', $views_data);
- \Drupal::setContainer($container);
- }
-
- /**
- * Sets up the entity type manager in the container.
- *
- * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
- * The entity type manager.
- */
- protected function setupEntityTypeManager(EntityTypeManagerInterface $entity_type_manager) {
- $container = \Drupal::hasContainer() ? \Drupal::getContainer() : new ContainerBuilder();
- $container->set('entity_type.manager', $entity_type_manager);
- $container->set('entity.manager', $entity_type_manager);
- \Drupal::setContainer($container);
- }
-
- /**
- * Sets up some test entity types and corresponding views data.
- *
- * @param \Drupal\Core\Entity\EntityInterface[][] $entities_by_type
- * Test entities keyed by entity type and entity ID.
- * @param \Drupal\Core\Entity\EntityInterface[][] $entities_by_type
- * Test entities keyed by entity type and revision ID.
- *
- * @return \Prophecy\Prophecy\ObjectProphecy
- */
- protected function setupEntityTypes($entities_by_type = [], $entity_revisions_by_type = []) {
- $entity_type_manager = $this->prophesize(EntityTypeManagerInterface::class);
- $entity_type0 = new EntityType([
- 'label' => 'First',
- 'id' => 'first',
- 'base_table' => 'entity_first',
- 'revision_table' => 'entity_first__revision',
- 'entity_keys' => [
- 'id' => 'id',
- 'revision' => 'vid',
- ],
- ]);
- $entity_type1 = new EntityType([
- 'label' => 'second',
- 'id' => 'second',
- 'base_table' => 'entity_second',
- 'revision_table' => 'entity_second__revision',
- 'entity_keys' => [
- 'id' => 'id',
- 'revision' => 'vid',
- ],
- ]);
-
- $entity_type_manager->getDefinitions()->willReturn([
- 'first' => $entity_type0,
- 'second' => $entity_type1,
- 'base_table' => 'entity_second',
- ]);
-
- $entity_type_manager->getDefinition('first')->willReturn($entity_type0);
- $entity_type_manager->getDefinition('second')->willReturn($entity_type1);
-
- // Setup the views data corresponding to the entity types.
- $views_data = $this->prophesize(ViewsData::class);
- $views_data->get('entity_first')->willReturn([
- 'table' => [
- 'entity type' => 'first',
- 'entity revision' => FALSE,
- ],
- ]);
- $views_data->get('entity_first__revision')->willReturn([
- 'table' => [
- 'entity type' => 'first',
- 'entity revision' => TRUE,
- ],
- ]);
- $views_data->get('entity_second')->willReturn([
- 'table' => [
- 'entity type' => 'second',
- 'entity revision' => FALSE,
- ],
- ]);
- $views_data->get('entity_second__revision')->willReturn([
- 'table' => [
- 'entity type' => 'second',
- 'entity revision' => TRUE,
- ],
- ]);
- $this->setupViewsData($views_data->reveal());
-
- // Setup the loading of entities and entity revisions.
- $entity_storages = [
- 'first' => $this->prophesize(EntityStorageInterface::class),
- 'second' => $this->prophesize(EntityStorageInterface::class),
- ];
-
- foreach ($entities_by_type as $entity_type_id => $entities) {
- foreach ($entities as $entity_id => $entity) {
- $entity_storages[$entity_type_id]->load($entity_id)->willReturn($entity);
- }
- $entity_storages[$entity_type_id]->loadMultiple(array_keys($entities))->willReturn($entities);
- }
-
- foreach ($entity_revisions_by_type as $entity_type_id => $entity_revisions) {
- foreach ($entity_revisions as $revision_id => $revision) {
- $entity_storages[$entity_type_id]->loadRevision($revision_id)->willReturn($revision);
- }
- }
-
- $entity_type_manager->getStorage('first')->willReturn($entity_storages['first']);
- $entity_type_manager->getStorage('second')->willReturn($entity_storages['second']);
-
- $this->setupEntityTypeManager($entity_type_manager->reveal());
-
- return $entity_type_manager;
- }
-
- /**
- * @covers ::loadEntities
- * @covers ::assignEntitiesToResult
- */
- public function testLoadEntitiesWithEmptyResult() {
- $view = $this->prophesize('Drupal\views\ViewExecutable')->reveal();
- $view_entity = $this->prophesize(ViewEntityInterface::class);
- $view_entity->get('base_table')->willReturn('entity_first');
- $view_entity->get('base_field')->willReturn('id');
- $view->storage = $view_entity->reveal();
-
- $entity_type_manager = $this->setupEntityTypes();
-
- $query = new Sql([], 'sql', [], $entity_type_manager->reveal());
- $query->view = $view;
-
- $result = [];
- $query->addField('entity_first', 'id', 'id');
- $query->loadEntities($result);
- $this->assertEmpty($result);
- }
-
- /**
- * @covers ::loadEntities
- * @covers ::assignEntitiesToResult
- */
- public function testLoadEntitiesWithNoRelationshipAndNoRevision() {
- $view = $this->prophesize('Drupal\views\ViewExecutable')->reveal();
- $view_entity = $this->prophesize(ViewEntityInterface::class);
- $view_entity->get('base_table')->willReturn('entity_first');
- $view_entity->get('base_field')->willReturn('id');
- $view->storage = $view_entity->reveal();
-
- $entities = [
- 'first' => [
- 1 => $this->prophesize(EntityInterface::class)->reveal(),
- 2 => $this->prophesize(EntityInterface::class)->reveal(),
- ],
- ];
- $entity_type_manager = $this->setupEntityTypes($entities);
-
- $query = new Sql([], 'sql', [], $entity_type_manager->reveal());
- $query->view = $view;
-
- $result = [];
- $result[] = new ResultRow([
- 'id' => 1,
- ]);
- // Note: Let the same entity be returned multiple times, for example to
- // support the translation usecase.
- $result[] = new ResultRow([
- 'id' => 2,
- ]);
- $result[] = new ResultRow([
- 'id' => 2,
- ]);
-
- $query->addField('entity_first', 'id', 'id');
- $query->loadEntities($result);
-
- $this->assertSame($entities['first'][1], $result[0]->_entity);
- $this->assertSame($entities['first'][2], $result[1]->_entity);
- $this->assertSame($entities['first'][2], $result[2]->_entity);
- }
-
- /**
- * Create a view with a relationship.
- */
- protected function setupViewWithRelationships(ViewExecutable $view, $base = 'entity_second') {
- // We don't use prophecy, because prophecy enforces methods.
- $relationship = $this->getMockBuilder(RelationshipPluginBase::class)->disableOriginalConstructor()->getMock();
- $relationship->definition['base'] = $base;
- $relationship->tableAlias = $base;
- $relationship->alias = $base;
-
- $view->relationship[$base] = $relationship;
- }
-
- /**
- * @covers ::loadEntities
- * @covers ::assignEntitiesToResult
- */
- public function testLoadEntitiesWithRelationship() {
- // We don't use prophecy, because prophecy enforces methods.
- $view = $this->getMockBuilder(ViewExecutable::class)->disableOriginalConstructor()->getMock();
- $this->setupViewWithRelationships($view);
-
- $view_entity = $this->prophesize(ViewEntityInterface::class);
- $view_entity->get('base_table')->willReturn('entity_first');
- $view_entity->get('base_field')->willReturn('id');
- $view->storage = $view_entity->reveal();
-
- $entities = [
- 'first' => [
- 1 => $this->prophesize(EntityInterface::class)->reveal(),
- 2 => $this->prophesize(EntityInterface::class)->reveal(),
- ],
- 'second' => [
- 11 => $this->prophesize(EntityInterface::class)->reveal(),
- 12 => $this->prophesize(EntityInterface::class)->reveal(),
- ],
- ];
- $entity_type_manager = $this->setupEntityTypes($entities);
-
- $query = new Sql([], 'sql', [], $entity_type_manager->reveal());
- $query->view = $view;
-
- $result = [];
- $result[] = new ResultRow([
- 'id' => 1,
- 'entity_second__id' => 11,
- ]);
- // Provide an explicit NULL value, to test the case of a non required
- // relationship.
- $result[] = new ResultRow([
- 'id' => 2,
- 'entity_second__id' => NULL,
- ]);
- $result[] = new ResultRow([
- 'id' => 2,
- 'entity_second__id' => 12,
- ]);
-
- $query->addField('entity_first', 'id', 'id');
- $query->addField('entity_second', 'id', 'entity_second__id');
- $query->loadEntities($result);
-
- $this->assertSame($entities['first'][1], $result[0]->_entity);
- $this->assertSame($entities['first'][2], $result[1]->_entity);
- $this->assertSame($entities['first'][2], $result[2]->_entity);
-
- $this->assertSame($entities['second'][11], $result[0]->_relationship_entities['entity_second']);
- $this->assertEquals([], $result[1]->_relationship_entities);
- $this->assertSame($entities['second'][12], $result[2]->_relationship_entities['entity_second']);
- }
-
- /**
- * @covers ::loadEntities
- * @covers ::assignEntitiesToResult
- */
- public function testLoadEntitiesWithRevision() {
- // We don't use prophecy, because prophecy enforces methods.
- $view = $this->getMockBuilder(ViewExecutable::class)
- ->disableOriginalConstructor()
- ->getMock();
-
- $view_entity = $this->prophesize(ViewEntityInterface::class);
- $view_entity->get('base_table')->willReturn('entity_first__revision');
- $view_entity->get('base_field')->willReturn('vid');
- $view->storage = $view_entity->reveal();
-
- $entity_revisions = [
- 'first' => [
- 1 => $this->prophesize(EntityInterface::class)->reveal(),
- 3 => $this->prophesize(EntityInterface::class)->reveal(),
- ],
- ];
- $entity_type_manager = $this->setupEntityTypes([], $entity_revisions);
-
- $query = new Sql([], 'sql', [], $entity_type_manager->reveal());
- $query->view = $view;
-
- $result = [];
- $result[] = new ResultRow([
- 'vid' => 1,
- ]);
- $result[] = new ResultRow([
- 'vid' => 1,
- ]);
- $result[] = new ResultRow([
- 'vid' => 3,
- ]);
-
- $query->addField('entity_first__revision', 'vid', 'vid');
- $query->loadEntities($result);
-
- $this->assertSame($entity_revisions['first'][1], $result[0]->_entity);
- $this->assertSame($entity_revisions['first'][1], $result[1]->_entity);
- $this->assertSame($entity_revisions['first'][3], $result[2]->_entity);
- }
-
- /**
- * @covers ::loadEntities
- * @covers ::assignEntitiesToResult
- */
- public function testLoadEntitiesWithRevisionOfSameEntityType() {
- // We don't use prophecy, because prophecy enforces methods.
- $view = $this->getMockBuilder(ViewExecutable::class)
- ->disableOriginalConstructor()
- ->getMock();
- $this->setupViewWithRelationships($view, 'entity_first__revision');
-
- $view_entity = $this->prophesize(ViewEntityInterface::class);
- $view_entity->get('base_table')->willReturn('entity_first');
- $view_entity->get('base_field')->willReturn('id');
- $view->storage = $view_entity->reveal();
-
- $entity = [
- 'first' => [
- 1 => $this->prophesize(EntityInterface::class)->reveal(),
- 2 => $this->prophesize(EntityInterface::class)->reveal(),
- ],
- ];
- $entity_revisions = [
- 'first' => [
- 1 => $this->prophesize(EntityInterface::class)->reveal(),
- 2 => $this->prophesize(EntityInterface::class)->reveal(),
- 3 => $this->prophesize(EntityInterface::class)->reveal(),
- ],
- ];
- $entity_type_manager = $this->setupEntityTypes($entity, $entity_revisions);
-
- $query = new Sql([], 'sql', [], $entity_type_manager->reveal());
- $query->view = $view;
-
- $result = [];
- $result[] = new ResultRow([
- 'id' => 1,
- 'entity_first__revision__vid' => 1,
- ]);
- $result[] = new ResultRow([
- 'id' => 2,
- 'entity_first__revision__vid' => 2,
- ]);
- $result[] = new ResultRow([
- 'id' => 2,
- 'entity_first__revision__vid' => 3,
- ]);
-
- $query->addField('entity_first', 'id', 'id');
- $query->addField('entity_first__revision', 'vid', 'entity_first__revision__vid');
- $query->loadEntities($result);
-
- $this->assertSame($entity['first'][1], $result[0]->_entity);
- $this->assertSame($entity['first'][2], $result[1]->_entity);
- $this->assertSame($entity['first'][2], $result[2]->_entity);
- $this->assertSame($entity_revisions['first'][1], $result[0]->_relationship_entities['entity_first__revision']);
- $this->assertSame($entity_revisions['first'][2], $result[1]->_relationship_entities['entity_first__revision']);
- $this->assertSame($entity_revisions['first'][3], $result[2]->_relationship_entities['entity_first__revision']);
- }
-
- /**
- * @covers ::loadEntities
- * @covers ::assignEntitiesToResult
- */
- public function testLoadEntitiesWithRelationshipAndRevision() {
- // We don't use prophecy, because prophecy enforces methods.
- $view = $this->getMockBuilder(ViewExecutable::class)->disableOriginalConstructor()->getMock();
- $this->setupViewWithRelationships($view);
-
- $view_entity = $this->prophesize(ViewEntityInterface::class);
- $view_entity->get('base_table')->willReturn('entity_first__revision');
- $view_entity->get('base_field')->willReturn('vid');
- $view->storage = $view_entity->reveal();
-
- $entities = [
- 'second' => [
- 11 => $this->prophesize(EntityInterface::class)->reveal(),
- 12 => $this->prophesize(EntityInterface::class)->reveal(),
- ],
- ];
- $entity_revisions = [
- 'first' => [
- 1 => $this->prophesize(EntityInterface::class)->reveal(),
- 3 => $this->prophesize(EntityInterface::class)->reveal(),
- ],
- ];
- $entity_type_manager = $this->setupEntityTypes($entities, $entity_revisions);
-
- $query = new Sql([], 'sql', [], $entity_type_manager->reveal());
- $query->view = $view;
-
- $result = [];
- $result[] = new ResultRow([
- 'vid' => 1,
- 'entity_second__id' => 11,
- ]);
- // Provide an explicit NULL value, to test the case of a non required
- // relationship.
- $result[] = new ResultRow([
- 'vid' => 1,
- 'entity_second__id' => NULL,
- ]);
- $result[] = new ResultRow([
- 'vid' => 3,
- 'entity_second__id' => 12,
- ]);
-
- $query->addField('entity_first__revision', 'vid', 'vid');
- $query->addField('entity_second', 'id', 'entity_second__id');
- $query->loadEntities($result);
-
- $this->assertSame($entity_revisions['first'][1], $result[0]->_entity);
- $this->assertSame($entity_revisions['first'][1], $result[1]->_entity);
- $this->assertSame($entity_revisions['first'][3], $result[2]->_entity);
-
- $this->assertSame($entities['second'][11], $result[0]->_relationship_entities['entity_second']);
- $this->assertEquals([], $result[1]->_relationship_entities);
- $this->assertSame($entities['second'][12], $result[2]->_relationship_entities['entity_second']);
- }
-
}
diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist
index 8619917..52bc19a 100644
--- a/core/phpcs.xml.dist
+++ b/core/phpcs.xml.dist
@@ -13,7 +13,13 @@
' . Html::escape(var_export($headers, TRUE)) . ''; } - /** - * Translates a CSS expression to its XPath equivalent. - * - * The search is relative to the root element (HTML tag normally) of the page. - * - * @param string $selector - * CSS selector to use in the search. - * @param bool $html - * (optional) Enables HTML support. Disable it for XML documents. - * @param string $prefix - * (optional) The prefix for the XPath expression. - * - * @return string - * The equivalent XPath of a CSS expression. - */ - protected function cssSelectToXpath($selector, $html = TRUE, $prefix = 'descendant-or-self::') { - return (new CssSelectorConverter($html))->toXPath($selector, $prefix); - } - } diff --git a/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php b/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php index b8be130..d4cd751 100644 --- a/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php +++ b/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php @@ -286,7 +286,7 @@ public function testDateTimezoneWithDateTimeObject() { * An array of arrays, each containing the input parameters for * DateTimePlusTest::testDates(). * - * @see DateTimePlusTest::testDates() + * @see DateTimePlusTest::testDates(). */ public function providerTestDates() { return array( @@ -313,7 +313,7 @@ public function providerTestDates() { * An array of arrays, each containing the input parameters for * DateTimePlusTest::testDates(). * - * @see DateTimePlusTest::testDates() + * @see DateTimePlusTest::testDates(). */ public function providerTestDateArrays() { return array( diff --git a/core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php b/core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php index dfd12bb..930dbe5 100644 --- a/core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php +++ b/core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php @@ -1,5 +1,4 @@ getMock('Drupal\Core\Extension\ModuleHandlerInterface'); diff --git a/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php b/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php index 98a18a3..fec4d4c 100644 --- a/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php +++ b/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php @@ -14,8 +14,7 @@ use Drupal\Core\Routing\RouteMatch; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Tests\UnitTestCase; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerAwareTrait; +use Symfony\Component\DependencyInjection\ContainerAware; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; @@ -281,8 +280,7 @@ public function getResult() { } } -class MockContainerAware implements ContainerAwareInterface { - use ContainerAwareTrait; +class MockContainerAware extends ContainerAware { public function getResult() { return 'This is container aware.'; } diff --git a/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php b/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php index 932edb7..9273606 100644 --- a/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php +++ b/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php @@ -147,7 +147,7 @@ function ($context) { } -class NaughtyRecursiveLogger implements LoggerInterface { +class NaughtyRecursiveLogger implements LoggerInterface { use LoggerTrait; protected $channel; diff --git a/core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php b/core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php index cc248b0..02f2015 100644 --- a/core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php +++ b/core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php @@ -65,7 +65,7 @@ public function testGetConverterException() { * An array of arrays, each containing the input parameters for * providerTestResolvers::testAddConverter(). * - * @see ParamConverterManagerTest::testAddConverter() + * @see ParamConverterManagerTest::testAddConverter(). */ public function providerTestAddConverter() { $converters[0]['unsorted'] = array( @@ -108,7 +108,7 @@ public function providerTestAddConverter() { * An array of arrays, each containing the input parameters for * providerTestResolvers::testGetConverter(). * - * @see ParamConverterManagerTest::testGetConverter() + * @see ParamConverterManagerTest::testGetConverter(). */ public function providerTestGetConverter() { return array( diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php index 2ceb9a3..f7a5d98 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php @@ -29,7 +29,7 @@ protected function setUp() { /** * Tests the getDerivativeFetcher method. * - * @see \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator::getDerivativeFetcher() + * @see \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator::getDerivativeFetcher(). */ public function testGetDerivativeFetcher() { $definitions = array(); diff --git a/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php b/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php index f83515c..13ade22 100644 --- a/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php +++ b/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php @@ -135,7 +135,7 @@ protected function setUp() { * * @dataProvider providerTestHasPermission * - * @see \Drupal\Core\Session\UserSession::hasPermission() + * @see \Drupal\Core\Session\UserSession::hasPermission(). */ public function testHasPermission($permission, array $sessions_with_access, array $sessions_without_access) { foreach ($sessions_with_access as $name) {