【问题标题】:Drupal 8 Preview button not workingDrupal 8预览按钮不起作用
【发布时间】:2016-03-15 14:20:05
【问题描述】:

使用自定义前端主题时,我的内容的预览按钮停止工作。它只是重定向到内容概览页面。

我是否在我的主题中遗漏了一些允许我使用“预览”功能的内容?

【问题讨论】:

  • 您查看过 Drupal dblog 或服务器的错误日志吗?里面有东西吗?

标签: drupal drupal-8 drupal-nodes


【解决方案1】:

您的网址中很可能包含?destination=admin/content。这是一个核心错误。当前的讨论可以在以下位置阅读:

https://www.drupal.org/node/2325463

【讨论】:

    【解决方案2】:

    Jason Ruyle 的回答是正确的,我遇到了同样的问题,并通过将此代码添加到我的模块来解决它:

    use Drupal\Core\Entity\EntityInterface;
    
    function my_module_entity_operation_alter(array &$operations, EntityInterface $entity) {
        if (isset($operations['edit']['query'])) {
            unset($operations['edit']['query']['destination']);
        }
        return $operations;
    }
    

    如果需要,还可以改进代码以针对正确的实体。

    【讨论】:

    • 我试过了,代码被触发了,但是好像一点效果都没有。你能解释一下为什么这段代码可以解决这个问题吗?
    • 已经有点时间了,但应该做的是从实体操作中的编辑 url 中删除目标参数(管理内容列表中的下拉/按钮)。但是现在应该修复该错误(请参阅drupal.org/node/2325463 的状态)。
    猜你喜欢
    • 2019-07-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-18
    • 2014-11-27
    • 1970-01-01
    相关资源
    最近更新 更多