[SOLVED] Change the fieldset / tab names from a content type XML file?

Is it possible to Change the fieldset / tab names for a content type XML file? If not, what are the options ( I assume changing it in a po-file will change all other content types)

So, in the screenshot, I want to change 'Default' to 'Something' and 'Categorization' to 'Another'.

We did that at work, let me grab my laptop to see how we actually did it :smile:

So, from a quick look at our code, it seems that the gist of it is:

from plone.dexterity.browser.add import DefaultAddForm
from plone.dexterity.browser.edit import DefaultEditForm

class ArticleAddForm(DefaultAddForm):
    default_fieldset_label = _('Article')

class ArticleEditForm(DefaultEditForm):
    default_fieldset_label = _('Article')

i.e. create a custom add/edit form for your content type and set the default_fieldset_label to your preferred name :smile:

only for the sake of completeness, the registration for the adapter:

<!-- Register AddForm for Collection -->
  <adapter
      factory=".views.CollectionAddFormView"
      provides="zope.publisher.interfaces.browser.IBrowserPage"
      for="Products.CMFCore.interfaces.IFolderish
           mfd.eportal.interfaces.IMfdEportalLayer
           plone.dexterity.interfaces.IDexterityFTI"
      name="Collection"
      />

  <!-- Override EditForm for Collection -->
  <browser:page
      name="edit"
      for="plone.app.contenttypes.interfaces.ICollection"
      class=".views.CollectionEditFormView"
      permission="cmf.ModifyPortalContent"
      layer="mfd.eportal.interfaces.IMfdEportalLayer"
      />
class CollectionAddForm(DefaultAddForm):
    portal_type = "Collection"
    default_fieldset_label = _('My Fieldset Label')

class CollectionEditForm(DefaultEditForm):
    portal_type = "Collection"
    default_fieldset_label = _('My Fieldset Label')

class CollectionAddFormView(DefaultAddView):
    form = CollectionAddForm

class CollectionEditFormView(DefaultEditView):
    form = CollectionEditForm

Another solution is to use a Diazo rule in your theme.

Additionally you could override the other group labels like this:


class ArticleAddForm(DefaultAddForm):
    def update(self):
        super().update()
        for group in self.groups:
            if group.id == "categorization":
                group.label = _("My custom label")

I got an error on 'id', but this (using label) works:

class CollectionAddForm(DefaultAddForm):
def update(self):
    super().update()
    for group in self.groups:
        if group.label == "Categorization":
            group.label =  "My

OK .. this was a wild guess :wink: looking at the plone.z3cform.fieldsets.group module it should be

group.__name__

instead of

group.id

This works, but I am courious about a few things and one remark.

It does seem like the important part in the adapter is the 'name', so I can change it to:

 for="*
       mfd.eportal.interfaces.IMfdEportalLayer
       plone.dexterity.interfaces.IDexterityFTI"
  name="Folder"

and it will work for 'Folders', it does not even look like I need the browser:page part

I also wonder, what is the line

portal_type = "Collection"

for ?

For the Add Form you need the Adapter, for the Edit Form you need the Browser Page.
The DefaultEditForm inherit from DexterityExtensibleForm and in this class the portal_type is needed.

Turns out I still have not solved the edit form (used * just to be sure), any idea?

  <!-- Override EditForm for Action Items -->
  <browser:page
      name="edit"
      for="*"
      class=".views.ActionItemsEditFormView"
      permission="cmf.ModifyPortalContent"
      layer="Myaddon.ActionItems.interfaces.IMyaddonActionitemsLayer"
      />

and in edit view I have the same as in add

class ActionItemsEditForm(DefaultEditForm):
    portal_type = "action_items"
    default_fieldset_label = 'Home'


class ActionItemsEditFormView(DefaultEditView):
    form = ActionItemsEditForm

I see that 'portal_type' is mentioned 'everywhere I look', but while making a content type TTW, I tried

<browser:page
    name="edit"
    for="Products.CMFCore.interfaces.IFolderish"
    class=".views.ActionItemsEditFormView"
    permission="cmf.ModifyPortalContent"

And used

portal_type = "my_content_type" 
default_fieldset_label = 'My Label'

in the edit form

And 'My Label' show both for 'Folder' and for 'My content type'