-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Replace head_title with Kicker #140
base: main
Are you sure you want to change the base?
Conversation
@iFlameing thanks for creating this Pull Request and helping to improve Plone! TL;DR: Finish pushing changes, pass all other checks, then paste a comment:
To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically. Happy hacking! |
@iFlameing I think we need to:
|
@davisagli I added the head title once again but I haven't tested it because I don't know how to test it. Also, it is a breaking change. where and how I should mention it? |
@iFlameing For starters, look at the result of the existing tests, which are failing. It looks like it is a problem to have 2 behavior registrations for the same interface, and here it is the same object even though it has an alias. To fix this, define IHeadTitle as a subclass of IKicker:
Next, test this change with our customer project. You can pip install this branch from github (https://pip.pypa.io/en/stable/topics/vcs-support/). If our backwards-compatibility efforts are successful, everything in that project should still work even if you don't change the content types to use the new behavior.
|
@iFlameing do you have time to look into this during the week? I would love to start using this for our different Plone distribution projects. |
<plone:behavior | ||
name="volto.kicker" | ||
title="Kicker field" | ||
description="Adds kicker field" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
description="Adds kicker field" | |
description="Adds kicker field (text to be shown above the headline)" |
description="Adds kicker field" | ||
provides=".kicker.IKicker" | ||
/> | ||
|
||
<plone:behavior | ||
name="volto.head_title" | ||
title="Head title field" | ||
description="Adds Head title field" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
description="Adds Head title field" | |
description="Deprecated (use volto.kicker instead)" |
|
||
head_title = schema.TextLine( | ||
title=_("label_head_title", default="Header title"), | ||
kicker = schema.TextLine( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we change the name of the field, it won't be backward-compatible.
There are a bunch of places in volto and in volto-light-theme which assume there is a field called head_title, not kicker.
We also have a catalog column which copies the value of the head_title field.
So, it'll be a lot easier if we keep the existing internal field name and only change the name of the behavior and the user-visible text.
kicker = schema.TextLine( | |
head_title = schema.TextLine( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davisagli didn't we agree to add a new "kicker" field in addition to the head_title field and then deprecate head_title? Of course we would have to write a migration for existing projects at some point. However, we would have a clean codebase and not an inconsistency in our code base.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tisto No, I thought the plan was to add a new behavior but keep the old field name. If we change the field name then any component which displays the kicker needs to check both the old and new field name, so it would make a lot of code more messy (and also take some time to find and update each location).
We can talk about it tomorrow but I don't think it's worth the effort to change the field name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davisagli ok, then this was a misunderstanding from my side. I leave this decision up to you. Just wanted to mention what I understood from our discussion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one last thing. I was under the assumption that we only support "kicker" in future releases. Since head_title never made it into core this would be a breaking change that is acceptable IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tisto There are already references to head_title
in core: https://github.com/search?q=repo%3Aplone%2Fvolto%20head_title&type=code
@@ -38,8 +38,8 @@ msgid "Creates a default page for the site using slate blocks" | |||
msgstr "" | |||
|
|||
#: plone/volto/behaviors/configure.zcml:42 | |||
msgid "Head title field" | |||
msgstr "Kopftitel Feld" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep the existing translations for "head title"; it's better than removing the translations.
@davisagli I don't know how to create an alias for headtitle. can you please take care of it?