1

When using a custom front-end theme, the preview button for my content stops working. It just redirects to the content overview page.

Am I missing something in my theme that allows me to use the 'preview' function?

apaderno
  • 28,547
  • 16
  • 75
  • 90

2 Answers2

0

You most likely have the ?destination=admin/content in your URL. This is a core bug. The current discussion can be read at:

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

Antoine Subit
  • 9,803
  • 4
  • 36
  • 52
0

Jason Ruyle's answer is correct, I had the same problem and solved it by adding this code to my module:

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;
}

The code could also be improved to target the right entities, if needed.

M.D.
  • 41
  • 6
  • I tried this, the code is being triggered, but it seems to have no effect at all. Can you explain why this code should fix the issue? – vrijdenker Dec 23 '16 at 13:05
  • 1
    It's been a bit of time, but what it should do is remove the destination parameter from the edit url in the entity operations (the dropdown/button in the admin content list). The bug should however be fixed now (see status of https://www.drupal.org/node/2325463). – M.D. Jan 21 '17 at 15:01