diff --git a/core/lib/Drupal/Core/Entity/EntityAccessController.php b/core/lib/Drupal/Core/Entity/EntityAccessController.php index 164b83e..4658d50 100644 --- a/core/lib/Drupal/Core/Entity/EntityAccessController.php +++ b/core/lib/Drupal/Core/Entity/EntityAccessController.php @@ -58,7 +58,7 @@ public function access(EntityInterface $entity, $operation, $langcode = Language // We grant access to the entity if both of these conditions are met: // - No modules say to deny access. // - At least one module says to grant access. - $access = module_invoke_all($entity->entityType() . '_access', $entity->getBCEntity(), $operation, $account, $langcode); + $access = module_invoke_all($entity->entityType() . '_access', $entity, $operation, $account, $langcode); if (($return = $this->processAccessHookResults($access)) === NULL) { // No module had an opinion about the access, so let's the access diff --git a/core/lib/Drupal/Core/Entity/EntityFormController.php b/core/lib/Drupal/Core/Entity/EntityFormController.php index ceb09de..e148048 100644 --- a/core/lib/Drupal/Core/Entity/EntityFormController.php +++ b/core/lib/Drupal/Core/Entity/EntityFormController.php @@ -506,9 +506,7 @@ public function getEntity() { */ protected function getTranslatedEntity(array $form_state) { $langcode = $this->getFormLangcode($form_state); - $translation = $this->entity->getTranslation($langcode); - // Ensure that the entity object is a BC entity if the original one is. - return $this->entity instanceof EntityBCDecorator ? $translation->getBCEntity() : $translation; + return $this->entity->getTranslation($langcode); } /** diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index f552c04..3c37450 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -1127,7 +1127,12 @@ function template_preprocess_forum_topic_list(&$variables) { $variables['topics'][$id]->title_link = l($topic->label(), 'node/' . $topic->id()); $variables['topics'][$id]->message = ''; } - $variables['topics'][$id]->submitted = theme('forum_submitted', array('topic' => $topic)); + $submitted_topic = (object) array( + 'uid' => $topic->getAuthorId(), + 'name' => $topic->getAuthor()->getUsername(), + 'created' => $topic->getCreatedTime(), + ); + $variables['topics'][$id]->submitted = theme('forum_submitted', array('topic' => $submitted_topic)); $variables['topics'][$id]->last_reply = theme('forum_submitted', array('topic' => isset($topic->last_reply) ? $topic->last_reply : NULL)); $variables['topics'][$id]->new_text = ''; diff --git a/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php b/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php index f9d701f..efbcf3b 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php +++ b/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php @@ -116,7 +116,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $ // default revision. There's no need to delete existing records if the node // is new. if ($this->isDefaultRevision()) { - \Drupal::entityManager()->getAccessController('node')->writeGrants($this->getBCEntity(), $update); + \Drupal::entityManager()->getAccessController('node')->writeGrants($this, $update); } } diff --git a/core/modules/node/node.api.php b/core/modules/node/node.api.php index f9b2f89..9caba58 100644 --- a/core/modules/node/node.api.php +++ b/core/modules/node/node.api.php @@ -260,7 +260,7 @@ function hook_node_grants($account, $op) { function hook_node_access_records(\Drupal\node\NodeInterface $node) { // We only care about the node if it has been marked private. If not, it is // treated just like any other node and we completely ignore it. - if ($node->private) { + if ($node->private->value) { $grants = array(); // Only published Catalan translations of private nodes should be viewable // to all users. If we fail to check $node->isPublished(), all users would be able diff --git a/core/modules/node/tests/modules/node_access_test/node_access_test.module b/core/modules/node/tests/modules/node_access_test/node_access_test.module index c200908..abc18c6 100644 --- a/core/modules/node/tests/modules/node_access_test/node_access_test.module +++ b/core/modules/node/tests/modules/node_access_test/node_access_test.module @@ -36,7 +36,7 @@ function node_access_test_node_grants($account, $op) { function node_access_test_node_access_records(NodeInterface $node) { $grants = array(); // For NodeAccessBaseTableTestCase, only set records for private nodes. - if (!Drupal::state()->get('node_access_test.private') || $node->private) { + if (!Drupal::state()->get('node_access_test.private') || $node->private->value) { $grants[] = array( 'realm' => 'node_access_test', 'gid' => 8888, @@ -78,6 +78,21 @@ function node_access_test_permission() { } /** + * Implements hook_entity_field_info(). + */ +function node_access_test_entity_field_info($entity_type) { + if ($entity_type === 'node') { + $info['definitions']['private'] = array( + 'type' => 'boolean_field', + 'label' => t('Private'), + 'computed' => TRUE, + 'list' => TRUE, + ); + return $info; + } +} + +/** * Implements hook_form_BASE_FORM_ID_alter(). */ function node_access_test_form_node_form_alter(&$form, $form_state) { @@ -88,7 +103,7 @@ function node_access_test_form_node_form_alter(&$form, $form_state) { '#type' => 'checkbox', '#title' => t('Private'), '#description' => t('Check here if this content should be set private and only shown to privileged users.'), - '#default_value' => isset($node->private) ? $node->private : FALSE, + '#default_value' => $node->private->value, ); } } @@ -129,12 +144,10 @@ function node_access_test_node_update(EntityInterface $node) { * Helper for node insert/update. */ function _node_access_test_node_write(EntityInterface $node) { - if (isset($node->private)) { - db_merge('node_access_test') - ->key(array('nid' => $node->id())) - ->fields(array('private' => (int) $node->private)) - ->execute(); - } + db_merge('node_access_test') + ->key(array('nid' => $node->id())) + ->fields(array('private' => (int) $node->private->value)) + ->execute(); } /** diff --git a/core/modules/translation/translation.module b/core/modules/translation/translation.module index 672549e..7f65448 100644 --- a/core/modules/translation/translation.module +++ b/core/modules/translation/translation.module @@ -566,7 +566,7 @@ function translation_language_switch_links_alter(array &$links, $type, $path) { foreach ($links as $langcode => $link) { if (isset($translations[$langcode]) && $translations[$langcode]->status) { // Translation in a different node. - $nid = $translations[$langcode]->nid; + $nid = $translations[$langcode] instanceof EntityInterface ? $translations[$langcode]->id() : $translations[$langcode]->nid; $links[$langcode]['href'] = 'node/' . $nid . $matches[2]; } else {