When trying this module in combination with layout_builder, I found out the current concept of this module doesn't fit well for the future.
I think instead of creating future releases with layout_builder compatibility, we should better:
a) Create a module which allows setting prefix / suffix (or token) values on field display. This would allow entering the suffix per display mode individually and wouldn't limit this to the (page) title field. Instead, you would set the prefix / suffix in the display modes (e.g. default, full, ... on the field) in layout_builder or not, where you need it.
This would be similar to how for example fences adds wrappers around the field, but for prefix / suffix strings.
Things to keep in mind for that plan:
- Translatability
- Token replacement
- Reusability for different view modes?
b) Keep the module as-is and tell the users, that this isn't well compatible with layout_builder. Instead, they should add custom blocks in layout builder before or after the title field.
We should check how to alter the page title (for different entities) most flexible and correctly.
Our goal is to make the page title (h1) differ from the entity label!
Some references:
- https://www.drupal.org/forum/support/module-development-and-code-questio...
- https://gorannikolovski.com/snippet/how-alter-page-title
- https://drupal.stackexchange.com/questions/181828/how-can-i-change-the-p...
- https://drupal.stackexchange.com/questions/187934/how-to-override-page-t...
- https://x-team.com/blog/drupal_set_title/
- http://www.thirstysix.com/how-can-i-change-page-title-drupal-8
- ...?
Another option would be something like this, but we'd need to check if it works with all entity types, layout builder, etc.: https://www.drupal.org/project/title_field_for_manage_display
Comments
Comment #2
anybodyComment #3
anybodyComment #4
anybodyWe should check how to alter the page title (for different entities) most flexible and correctly.
Our goal is to make the page title (h1) differ from the entity label!
Some references:
https://www.drupal.org/forum/support/module-development-and-code-questio...
https://gorannikolovski.com/snippet/how-alter-page-title
http://www.thirstysix.com/how-can-i-change-page-title-drupal-8
...?
Comment #5
anybodyComment #6
anybodyComment #7
anybodyComment #8
anybodyThinking about this a bit more, I think we should implement this as a Metatag extending module to use it's well known functionality and ecosystem. See #3455655: Metatag contrib module to override the (visible) page title ("metatag_page_heading")
Then we could deprecate this module in favor of that and might not only solve this, but also have features like cross-entity-support out of the box.
Comment #9
anybodyMetatag Page Heading module seems to work great with layout_builder, so this might be the prefered option for the future: #3466625: Test if this works with Layout Builder