Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layouts: Disabling Main page content has no effect #5808

Open
kswan opened this issue Sep 28, 2022 · 11 comments
Open

Layouts: Disabling Main page content has no effect #5808

kswan opened this issue Sep 28, 2022 · 11 comments

Comments

@kswan
Copy link

kswan commented Sep 28, 2022

Description of the bug

When managing blocks on a node page layout, if the Main page content is disabled, the content is still displayed on the node page.

Steps To Reproduce

To reproduce the behavior:

  1. Create a page with some content in the body field.
  2. Create a layout using the path "node/%".
  3. Disable the Main page content block.
  4. View the page.

Actual behavior

The Main page content is displayed even though it is disabled.

Expected behavior

The disabled block should not be displayed.

Additional information

Add any other information that could help, such as:

  • Backdrop CMS version: 1.23.0
@laryn
Copy link
Contributor

laryn commented Sep 28, 2022

Confirmed. (If you fully remove the block it doesn't show, if you disable the block it still shows up).

@jjmonterey
Copy link

I confirm that I have encountered this behavior also

@stpaultim
Copy link
Member

stpaultim commented Apr 1, 2023

We looked at this with @jjmonterey after the weekly meetings this week.

This seems like it might be a problem that quite a few people would encounter, but not necessarily recognize as a bug. It's pretty easy to work around the problem, but could be very confusing to people.

Has anyone had a chance to look at this and see what is causing it and/or if it's an easy or difficult fix?

@klonos
Copy link
Member

klonos commented Apr 1, 2023

I vaguely recall something about this being by design (@docwilmot or @jenlampton might know more about this). Something about not allowing people to "shoot themselves on the foot".

I think that we should first figure out if there is a legit use case to allow the main content block to be hidden*. In other words, is the issue here an actual bug (are people actually trying to hide the main content block), or simply a matter of inconsistency (the action to disable exists because it is available for all blocks in general, yet does nothing for this specific block). So our approach should be:

  • If the main content block should not be allowed to be disabled/removed from layouts, then we should remove the "Disable" (and "Remove"?) action for this block.
  • If it should be allowed to be disabled/removed (even if edge cases), then we could do one or more of the following things:
    • add a confirmation message before disabling/removing the block, letting people know that this can break things
    • add a warning at the top of the block management UI for layouts where the main content block has been removed/disabled

My quick 2c.

*@kswan, @jjmonterey, @stpaultim can you guys please outline your use case for wanting to disable the main content block?

@klonos
Copy link
Member

klonos commented Apr 2, 2023

...I just though of a use case: when you want to replace the main content block in node/% layouts (in which case it is actually one of the display modes with all its fields) with individual field blocks managed via the block UI. If that is the most common (or only) use case, then I believe that the reason why we have gotten into this situation is because field blocks were introduced as a feature later (in 1.3.0 with #1100), and most likely we haven't though of this issue here when introducing that.

@stpaultim
Copy link
Member

stpaultim commented Apr 2, 2023

@klonos Yes, the use case you described is the one that we had in mind.

During office hours @jjmonterey demonstrated that after creating a Layout for a type of node and implementing field blocks, he tried to disable the main content block to prevent the layout from displaying two versions of the same node.

To make this work, he had to "hide" all the fields on the default node display mode. Very weird.

@kiamlaluno
Copy link
Member

kiamlaluno commented Apr 3, 2023

Is selecting a different display mode for the layout possible?
In this way, the layout would use a display mode that does not show the fields already shown in field blocks, but the default display mode would be used in other places where a node is shown, and all the fields will be displayed.

@olafgrabienski
Copy link

... on a node page layout, if the Main page content is disabled, the content is still displayed on the node page.

Confirmed. (If you fully remove the block it doesn't show, if you disable the block it still shows up).

Maybe an oversight when the option to disable the blocks was introduced?

@klonos
Copy link
Member

klonos commented Apr 3, 2023

Is selecting a different display mode for the layout possible?

Not possible, but that's what #5774 proposes if I'm not mistaken.

@jjmonterey
Copy link

Adding a custom display does not override the default display, the default main content block will display even if it is disabled.

Manage display page

Custom Display mode with main content block enabled

Disabling the main content block does not make a difference

Custom Display mode with main content block disabled

Removing the main content block renders the desired display

Custom Display mode with main content block removed

Disabling the main content block AND hiding the fields in the default display also renders the desired layout

Default display fields hidden

Main content block disabled but all fields hidden

In Drupal using Display Suite layouts Display Suite creates a custom layout in the CONTENT Section only although other custom regions can be displayed or disabled.

Drupal display

Drupal HTML Display Suite

The advantage of being able to render a custom layout inside the content region is that a Boxton Layout could be used almost exclusively.

It seems to me that selecting a custom Display Mode should immediately bring up a configure layout screen to add a custom layout, since creating a custom display mode will use the default layout if it doesn't specify a custom layout - somewhat defeating the purpose of a custom display mode.

@kswan
Copy link
Author

kswan commented Apr 3, 2023

@klonos:

...I just though of a use case: when you want to replace the main content block in node/% layouts (in which case it is actually one of the display modes with all its fields) with individual field blocks managed via the block UI. If that is the most common (or only) use case, then I believe that the reason why we have gotten into this situation is because field blocks were introduced as a feature later (in 1.3.0 with #1100), and most likely we haven't though of this issue here when introducing that.

Yes, this is the use case that resulted in this issue.

A contributing factor is the note shown on the Main page content block that states "This block may be required for this page to work properly." Due to this note, I was hesitant to remove the block and thought it safer to just disable it.
image

Since disabling the block had no effect, I removed the block and the layout works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants