Support from Acquia helps fund testing for Drupal Acquia logo

Comments

catch’s picture

Priority: Major » Normal

There's another issue for this somewhere, however I can't find it now. Either way this is just a normal bug, not major.

iSampo’s picture

The patch provided works as it should.

Sidenote:
What about the sites that want to take full control of the blocks using the Context module?
Should they be able to disable the main content block from the block admin page?

Usually I disable all of the blocks when building the site (when this bug still existed) and then create a global Context that puts the main content in its place. But now that I tried to disable the main content block with this bug (and without Context), the content seems to always stay in the content area (which is really good if you don't have an admin theme and you'd disable your main content block). I think this is how it's supposed to work?
Sorry for getting maybe a bit off-rails here.

droplet’s picture

@iSampo,

no functional changes in above patch. Try to create a thread in Context issue page and see what the maintainer said :)

ivander’s picture

main_content_block_required.patch queued for re-testing.

jantoine’s picture

Status: Needs review » Closed (duplicate)

I think #687686: Prevent hiding the Content Block on particular pages is the duplicate issue catch was referring too.

droplet’s picture

Status: Closed (duplicate) » Needs review

It seems like different issue to me. #687686 force to show Content block at frontend? and this one fixing bug at backend.

#687686,

+ // With the block module, it's possible to disable the main content block.

This issue is fixing this. At least can't disable it through UI

valthebald’s picture

Main page content block is required

where this assumption comes from?

benjy’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll
git apply ~/patches/main_content_block_required_0.patch
error: patch failed: core/modules/block/block.admin.inc:173
error: core/modules/block/block.admin.inc: patch does not apply

The validation should now be moved into BlockListController.

grisendo’s picture

Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
877 bytes

Re-rolled

Status: Needs review » Needs work

The last submitted patch, 9: main_content_block_required_9.patch, failed testing.

grisendo’s picture

Block naming changed a bit in that form, so I made changes reflected on interdiff.
Also, changed error message to make it more clear.

benjy’s picture

+++ b/core/modules/block/lib/Drupal/block/BlockListController.php
@@ -391,7 +391,10 @@ public function getOperations(EntityInterface $entity) {
+      form_set_error('blocks][' . $content, t('Main system content block needs to be placed in some region.'));

Should this be "Main page content block..."

Other than that, looks ready to go.

grisendo’s picture

grisendo’s picture

Status: Needs review » Needs work

The last submitted patch, 14: main_content_block_required-14.only-test.must-fail.patch, failed testing.

grisendo’s picture

Status: Needs work » Needs review
grisendo’s picture

Green!

benjy’s picture

  1. +++ b/core/modules/block/lib/Drupal/block/Tests/BlockUiTest.php
    @@ -117,6 +130,21 @@ function testBlockAdminUiPage() {
    +   * Tests that the main page content block needs to be assigned in some region.
    

    "needs to be assigned to a region."

  2. +++ b/core/modules/block/lib/Drupal/block/Tests/BlockUiTest.php
    @@ -117,6 +130,21 @@ function testBlockAdminUiPage() {
    +    $this->assertText(t('Main page content block needs to be placed in some region.'), 'Failed to disable main page content block.');
    

    Should be: "placed in a region"

  3. +++ b/core/modules/block/lib/Drupal/block/Tests/BlockUiTest.php
    @@ -117,6 +130,21 @@ function testBlockAdminUiPage() {
    +    // Try to set main page content block in main content region.
    

    should be "Try to set main page content block in the content region."

  4. +++ b/core/modules/block/lib/Drupal/block/Tests/BlockUiTest.php
    @@ -117,6 +130,21 @@ function testBlockAdminUiPage() {
    +    $this->assertText(t('The block settings have been updated.'), 'Main page content block successfully moved to Content region.');
    

    no capital on "Content"

Sorry, some nitpicking text remarks!

grisendo’s picture

Status: Needs review » Needs work

The last submitted patch, 19: main_content_block_required-19.only-test.must-fail.patch, failed testing.

grisendo’s picture

Status: Needs work » Needs review

Test completed

benjy’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

Xano’s picture

Xano’s picture

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 19: main_content_block_required-19.patch, failed testing.

Xano’s picture

Status: Needs work » Needs review
FileSize
4.16 KB

Re-roll.

Status: Needs review » Needs work

The last submitted patch, 26: drupal_1380858_26.patch, failed testing.

Xano’s picture

Status: Needs work » Needs review

26: drupal_1380858_26.patch queued for re-testing.

benjy’s picture

Status: Needs review » Reviewed & tested by the community

Was previously RTBC so setting back.

xjm’s picture

26: drupal_1380858_26.patch queued for re-testing.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 26: drupal_1380858_26.patch, failed testing.

benjy’s picture

+++ b/core/modules/block/lib/Drupal/block/BlockListController.php
@@ -396,7 +396,10 @@ public function getOperations(EntityInterface $entity) {
+      form_set_error('blocks][' . $content, t('Main page content block needs to be placed in a region.'));

This should at least be:

\Drupal::service('form_builder')->setErrorByName()

And we should probably inject the form_builder service.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

quietone’s picture

Version: 8.9.x-dev » 9.3.x-dev
Issue tags: +Bug Smash Initiative

This needs an issue summary update. In particular, what is the proposed resolution?

And an updated patch for 9.3.x

quietone’s picture

Forgot to add tag.

pameeela’s picture

Status: Needs work » Closed (duplicate)
Related issues: +#2546590: Main content block shows up on page, even if hidden

I know that usually the newer issue should be closed as a duplicate, but in this case #2546590: Main content block shows up on page, even if hidden has much more, and much more recent, activity so I'm going to close this one to prevent possibly working on two different approaches. I will move credit there for contributors to this issue.