That bug was is not new (#1286410: Access denied - You are not authorized to access this page.) and finally I thought I should fix it.

The problem is that Display Suite doesn't check whether a layout is present and the view mode isn't overridden. I also fixed the typo ("overriden" instead of "overridden").

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yannickoo’s picture

Status: Active » Needs review
FileSize
658 bytes
yannickoo’s picture

Version: 7.x-2.x-dev » 8.x-2.x-dev
FileSize
658 bytes

The patch should work for 8.x-2.x but I created an extra patch for it :)

swentel’s picture

+++ b/ds.moduleundefined
@@ -1325,9 +1325,9 @@ function ds_contextual_links_view_alter(&$element, $items) {
+    if (empty($layout) && !$overridden || $layout && $overridden === NULL) {

this looks freaky because you now have this:

AND OR AND

without any parentheses, I assume we want to group this no ?

yannickoo’s picture

Oh sorry, will add this, hold on :D

yannickoo’s picture

Version: 8.x-2.x-dev » 7.x-2.x-dev
FileSize
662 bytes
yannickoo’s picture

Version: 7.x-2.x-dev » 8.x-2.x-dev
FileSize
662 bytes
aspilicious’s picture

I don't think your fix is correct:

-    $overriden = (!empty($view_mode_settings[$view_mode]['custom_settings']) ? TRUE : FALSE);
+    $overridden = (!empty($view_mode_settings[$view_mode]['custom_settings']) ? TRUE : FALSE);
 
-    if (empty($layout) && !$overriden) {
+    if ((empty($layout) && !$overridden) || ($layout && $overridden === NULL)) {
       $admin_path .= '/display';
     }

First you set the variable to TRUE or FALSE and afterwards you check if it equals NULL....
I have the same problem but it is only related to the default view mode afaict.
When accessing the default view_mode the machine name is not appended to the manage display path.

yannickoo’s picture

Version: 8.x-2.x-dev » 7.x-2.x-dev
FileSize
472 bytes

I will create a follow-up issue for the typo but I figured out that the check for the $layout isn't necessary.

yannickoo’s picture

Version: 7.x-2.x-dev » 8.x-2.x-dev
FileSize
472 bytes
aspilicious’s picture

Hmmm this could work. I let this to Swentel to verify if it's ok.
If we don't need the $layout checkout we should remove

// Check if we have a configured layout. Do not fallback to default.
$layout = ds_get_layout($entity_type, $bundle, $view_mode, FALSE);
yannickoo’s picture

Version: 8.x-2.x-dev » 7.x-2.x-dev
FileSize
972 bytes

That is true!

yannickoo’s picture

Version: 7.x-2.x-dev » 8.x-2.x-dev
FileSize
982 bytes
swentel’s picture

Version: 8.x-2.x-dev » 7.x-2.x-dev

So yeah, that problably makes sense indeed, will test this some more, going to write for a test for it as well to make sure this stays ok in the future.

swentel’s picture

Status: Needs review » Fixed

Ironically enough I hit this bug during my demo in Portland, but could not reproduce anymore locally. Anyway committed because the fix looks sane, I've changed the typo's as well in both branches.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Linked issue