Drupal 8预览节点在保存之前中断

时间:2017-10-02 19:35:13

标签: php drupal drupal-8

尝试在保存之前预览节点时,我收到以下错误:

The website encountered an unexpected error. Please try again later.

Drupal\Core\Entity\EntityMalformedException: The "node" entity cannot have a URI as it does not have an ID in Drupal\Core\Entity\Entity->toUrl() (line 179 of core/lib/Drupal/Core/Entity/Entity.php).
Drupal\Core\Entity\Entity->urlInfo('revision') (Line: 120)
Drupal\Core\Field\Plugin\Field\FieldFormatter\StringFormatter->viewElements(Object, 'en') (Line: 80)
Drupal\Core\Field\FormatterBase->view(Object, 'en') (Line: 259)
Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple(Array) (Line: 320)
Drupal\Core\Entity\EntityViewBuilder->buildComponents(Array, Array, Array, 'full') (Line: 24)
Drupal\node\NodeViewBuilder->buildComponents(Array, Array, Array, 'full') (Line: 263)
Drupal\Core\Entity\EntityViewBuilder->buildMultiple(Array) (Line: 220)
Drupal\Core\Entity\EntityViewBuilder->build(Array)
call_user_func(Array, Array) (Line: 376)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 149)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

我已经看到过这样的错误(在这种情况下,这是一个我们不会使用的评论问题)。我想知道是否有其他人在Drupal 8中遇到过这个问题?

麦克

1 个答案:

答案 0 :(得分:0)

您的内容类型似乎有一个带有"纯文本"的文本字段。格式化程序用"链接到节点" " Full"中的选项查看模式。它会在您预览时尝试构建指向新节点的链接,并且失败(当然,因为需要节点ID来构建链接,但在保存节点之前不会设置它)。

我认为没有任何理由可以在" Full"查看模式(因为这样的链接引用相同的节点页面),所以只需取消选中"链接到节点"字段设置中的选项。