updated core from 8.4 to 8.5 : bug with login_destination

This commit is contained in:
Bachir Soussi Chiadmi
2018-03-13 14:01:21 +01:00
parent 0d78da249b
commit e668535a4e
3486 changed files with 89604 additions and 33283 deletions
+10 -17
View File
@@ -130,10 +130,10 @@ function quickedit_preprocess_page_title(&$variables) {
function quickedit_preprocess_field(&$variables) {
$variables['#cache']['contexts'][] = 'user.permissions';
$element = $variables['element'];
/** @var $entity \Drupal\Core\Entity\EntityInterface */
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
$entity = $element['#object'];
if (!\Drupal::currentUser()->hasPermission('access in-place editing') || !_quickedit_entity_is_latest_revision($entity)) {
if (!\Drupal::currentUser()->hasPermission('access in-place editing') || !$entity->isLatestRevision()) {
return;
}
@@ -157,8 +157,9 @@ function quickedit_preprocess_field(&$variables) {
* Implements hook_entity_view_alter().
*/
function quickedit_entity_view_alter(&$build, EntityInterface $entity, EntityViewDisplayInterface $display) {
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
$build['#cache']['contexts'][] = 'user.permissions';
if (!\Drupal::currentUser()->hasPermission('access in-place editing') || !_quickedit_entity_is_latest_revision($entity)) {
if (!\Drupal::currentUser()->hasPermission('access in-place editing') || !$entity->isLatestRevision()) {
return;
}
@@ -174,22 +175,14 @@ function quickedit_entity_view_alter(&$build, EntityInterface $entity, EntityVie
* @return bool
* TRUE if the loaded entity is the latest revision, FALSE otherwise.
*
* @todo Remove this method once better support for pending revisions is added
* to core https://www.drupal.org/node/2784201.
* @deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0. Use
* \Drupal\Core\Entity\RevisionableInterface::isLatestRevision() instead.
* As internal API, _quickedit_entity_is_latest_revision() may also be removed
* in a minor release.
*
* @internal
*/
function _quickedit_entity_is_latest_revision(ContentEntityInterface $entity) {
if (!$entity->getEntityType()->isRevisionable() || $entity->isNew()) {
return TRUE;
}
$latest_revision = \Drupal::entityTypeManager()
->getStorage($entity->getEntityTypeId())
->getQuery()
->latestRevision()
->condition($entity->getEntityType()->getKey('id'), $entity->id())
->execute();
return !empty($latest_revision) && $entity->getLoadedRevisionId() == key($latest_revision) ? TRUE : FALSE;
@trigger_error('_quickedit_entity_is_latest_revision() is deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0. Use \Drupal\Core\Entity\RevisionableInterface::isLatestRevision() instead. As internal API, _quickedit_entity_is_latest_revision() may also be removed in a minor release.', E_USER_DEPRECATED);
return $entity->isLatestRevision();
}