Problem

When you expose let's say a menu as a block, you have an "Edit menu" and a "Configure block" contextual action on the block. Now if you go to either, you can edit the name/title/label of the object. They are the same textual value. If you edit the menu title/label, it will not change the block, if you edit the block label, it will not change the menu. Although the block is initialised with the object's title, they are disconnected afterwards.

David Rothstein posts in #663946: Merge "List links" page into "Edit menu" page that he sees this is a major usability issue. I'm opening this issue to make sure this is tracked, but not sure how how a Drupal 7-like solution would work in the Drupal 8 system. Quoting David:

I think it's probably a pre-existing problem in Drupal 8 (not introduced here), but a pretty major one. In Drupal 7 this would only happen if you deliberately configured the block to have a different title than the menu to begin with. By default, though, it would work as expected. In Drupal 8, there doesn't seem to be any way to have the block title automatically linked to the menu title any more?

Same holds true for custom block instances, etc.

Proposal

Discuss and figure out if we have any good ideas for this.

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Bug because it is a feature regression from Drupal 7
Issue priority Major because it is a significant usability issue
Prioritized changes The main goal of this issue is usability.

Comments

Gábor Hojtsy’s picture

Issue tags: +Usability

Track for usability.

David_Rothstein’s picture

Title: Disconnect between object title and block title confusing » No longer possible to create a block whose title is automatically tied to the underlying object's title
Priority: Normal » Major

I think this is a major regression; it would be a pretty fundamental feature to lose.

To create a menu block and have its title automatically be the same as the menu (even when someone goes back and edits the menu later) is the default behavior in Drupal 7 and seems like a basic expectation to me.

Bojhan’s picture

Is this a regression? I am a little afraid of saying "just title" there surely are other properties that will influence this.

Gábor Hojtsy’s picture

I believe it is only the title. Drupal 7 had this weird feature where the block title inherited the object title IF you put an empty string in the title and otherwise you could override it. If you *really* wanted an empty block title, you needed to put in <none> I think.

Dave Reid’s picture

Could this be fixed by having some kind of token replacement used in these types of block titles by default? If it's provided with a menu context, replace title with [menu:title] by default?

sun’s picture

#5 sounds like a stellar idea to me. Potentially allows us to get rid of quite some custom code and one-off hacks for various special conditions.

Gábor Hojtsy’s picture

Well, if we'd go with tokens, it would be [menu:title], [author:name], [view:display:title], etc. depending on where the block comes from. I'm not sure that is very discoverable as-is, but if implementing modules would inject their suggested token at least into the description then that can be a stop-gap, if we have no better ideas.

Bojhan’s picture

This does make sense, I am worried without a browser though people will have no clue what that is? We can probably add it in the description.

klonos’s picture

I'm not sure this is a bug. I see it as a feature in certain use cases. If we tie these back together, can we make it the default option but still have a way for it to be customized?...

I was thinking that perhaps the block title should be pre-populated with the menu title (or what have you) and be disabled/grayed-out by default. There'd be a link to the menu edit form in order to hop and edit the actual object, then save/cancel and return back to the block edit form (that would be now updated with the new title). There'd also be some description text stating that this value is kept in sync with the menu/object title, but there'd be a "override" link (similar to the edit machine name) that would allow the sync to be broken and a custom block name to be used. If the title is overridden, this "override" link would become a "reset" link that would restore sync between the block title and the object title.

Sounds sane?

David_Rothstein’s picture

I'm not sure this is a bug. I see it as a feature in certain use cases. If we tie these back together, can we make it the default option but still have a way for it to be customized?...

Maybe not a bug per se, but an important feature that disappeared. The disappearance of a feature is not itself a feature :)

But yes, we should definitely retain the ability to override the default and customize the title (same as Drupal 7).

Unfortunately doesn't seem like there's an easy way to go back to how this used to work (since titles are now used to generate machine names)... but as mentioned above the old UI wasn't great anyway. Some kind of greyed out default plus auto-generated machine name makes sense to me too for a new UI.

yoroy’s picture

Issue summary: View changes

Just tested this and the situation is still the same indeed. Edit the menu title and the block title is not updated. Edit the block title and the menu title is not updated. (Additionally, I don't see 'Edit menu' contextual links on any menu either, probably a different issue)

metzlerd’s picture

Triage Comments:

  • Summary is clear and up to date
  • Problem is still current and reproducible
  • Adding Beta Evaluation
tstoeckler’s picture

Note that Views Blocks already allow re-using the view title or optionally overriding, which is exactly the pattern we want here. We just need to make the functionality a bit more generic and use it for menu blocks.

xjm’s picture

(Saving proposed issue credit for discussion and triage participants at LA.)

tim.plunkett’s picture

Issue tags: +Needs tests

Let's get some tests for that menu block example.

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.

heddn’s picture

It seems like we are trying to do something in this space already. See template_preprocess_block(). But the title doesn't exist at #title, rather in $variables['elements']['content']['#block_content']->info->value;

// A block's label is configuration: it is static. Allow dynamic labels to be
  // set in the render array.
  if (isset($variables['elements']['content']['#title']) && !empty($variables['configuration']['label_display'])) {
    $variables['label'] = $variables['elements']['content']['#title'];
}
  }

It would also be nice to have a config option on the block to allow override of the block content label directly from the block config.

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.

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

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

catch’s picture

Title: No longer possible to create a block whose title is automatically tied to the underlying object's title » Allow block titles to be automatically tied to the underlying object
Category: Bug report » Feature request
Priority: Major » Normal
Issue tags: +Bug Smash Initiative

Re-categorising this as a feature request, the old feature has been gone for eleven+ years now, also doesn't seem to be blocking contributed modules or similar.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.