Jump to content

Set Type of title field from PageTitleLanguage to PageTitle per Template ?


Recommended Posts

I made a Newsletter-System for the customer where you can create Newsletters in "different languages", this means at the creation you have multiple checkboxes with the languages where you can check in which language your newsletter should be. After the creation it renders only the checked languages as language tabs for each multilang field you have (including the title field). Now the title field represents the "Filename" of the Newsletter which dont need to be multilang. 


The Problem I encountered:

Let's say I create a new Newsletter called 20160811_testNewsletter only in the german language. Since french is the default language I must fill it out.



After the creation the user only sees the german tabs for each field including the title field. The Problem that the user encounter is, that he can't change the Filename(title) when he makes a mistake and need to change it or when he copies a existing german newsletter where he want to change the filename, because he can only see the German Tab. Since the Filename(title) dosen't have multilang names, it doesn't need to be a multilang field. Now the other problem is that when I can change the fieldtype of title to a normal PageTitle it affects it globally which is not right. There other Custom-Build-Tools in the System where the title field need to be multilang.



I think there are two possible ways:

- Anykind of Hack to allow type changing for fields on Template basis (Perhaps with a hook?).

- A hook which would update the default value of the title field every time with the value of the the other lang tabs, when I change/fill up the other field(german, italian etc... ) and save afterwards. 


Link to comment
Share on other sites

Wouldn't skip this the PageAdd Section? The customer need to define a specific filename(not an auto generated). He also wanted this "pre-selection" of languages and if its a internal newsletter checkbox. So "Name format for children" is possibly not an option. But still thanks for your effort @Robin S.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By donatas
      how would I do a multi-language website search with just a selector?
      I have many multi-lang fields and I want to do a search through all of them at once and through all of their language values.
      Is there a "selector way" of doing this? Maybe something like `title|title:de|title:it`? It seems I have seen this somewhere a long time ago but can't find in any documentation or forum search...
      Or the only way of doing it is by running separate searches for each language with output formatting off and then consolidating it all in one single results array?
      Because I still want to give users a result, even if it is in another language than current $user. Visitors mostly will be searching for specific terms that are very similar in all languages, but might be not used in one language version of a single page, for example. Or the user might not have switched language tohis prefered and did the search first, etc.. (many use cases in my situation)
      $pages->find('title~='.$q) - maybe different operator is needed? /en/search/?q=visit = 1 results /it/search/?q=visit = 0 results Thanks for any advice!
    • By sebr
      One of my customers needs to have his site translated by a publisher. He asks me if it is possible to create a role that could only edit the German version of the pages, without permission on the English version.
      I haven't found any permission related to this need, but maybe it's possible from a hook?
      Thank you for your help
    • By SwimToWin
      When webmaster un-globals the Title field (for instance to have a person template with first and last name), there are some unintended consequences. For a site that uses Title on 90% of templates, un-global isn't really useful because it makes adding a new page harder for novice editors:
      Title field disappears from "Add New" dialog. When I "Add New" page using a template that DOES use the Title field, then the Title field is no longer shown in the Add New dialog window (in this window, an editor will enter Title and Name - and the page is then created and shown to the user in edit mode). No other "pseudo-title" fields can be added to the "Add New" dialog (and it's not possible to skip the two-step page creation process). (There is no simple way to pre-populate the Title field on templates.) Consider these flows:
      When Title field is global:
      From Page Tree, press New to create a new page, "Add New" page is shown with Title and Name fields, (User may need to select Template) Enter Title (Name is automatically set), The new page is shown - start editing fields Observation: Title and Name are shown on same page (good!). Page is created with little mental effort.
      When Title field is un-global and Page Template has a Title field:
      From Page Tree, press New to create a new page, "Add New" page is shown with Name field (but Title is no longer shown when template DOES have the Title field), (User may need to select Template) Enter Name, The new page is shown - start editing fields ("where am I?"). Enter Title (user no longer sees Title and Name at the same time) Observation: Redundant entries (Name and Title are often identical). Name and Title are separated across pages.
      Better: Show Title and Name on "Add New" page, use Title to set Name (as when Title field is global).
      When Title field is un-global and Page Template doesn't have a Title field:
      Webmaster goes to Template -> Advanced to set "List of fields to display in the admin Page List" (example: "{foo} - {bar}"). Thanks to Robins S for pointing this out. Webmaster cannot specify "Title" fields to be filled in on the "Add New" page. Steps:
      From Page Tree, press New to create a new page, "Add New" page is shown with Name field, (User may need to select Template) Enter Name, The new page is shown - start editing fields ("where am I?"). Better: Setup allows webmaster to specify "Title" fields to be filled in on the "Add New" page.
      Even better:
      Skip the "Add New" dialog page and go directly to the resulting Title page (when only one Template can be selected).
      Maybe by adding a GUID or other temporary page name that is later renamed?
      Also I don't think it's possible to pre-populate the Title field in the Administration? (for details, see Pavle's comment).
      See also: Creating a page without a title? (from 2012 - so I think it's OK to begin a new thread).
    • By louisstephens
      So I ran into a strange error this morning when trying to publish a page. I went to publish a new page under "clients", but I get an error that says "Cannot be published until errors are corrected". I thought perhaps I had missed a required field so I checked, but none of the fields are marked as required. I then checked to see if I could just add a basic page (default basic-page.php template) under the homepage, but I get the exact same error when trying to publish. When looking at the template, I don't see any error messages being displayed above any fields.
      The odd thing I found though was if I got to "settings"  and uncheck "unpublished", I can then publish the page without errors. I did upgrade earlier today to the newest version to hopefully fix an issue I had yesterday (which it did). Has anyone run into this error before? 
      Well, after a lot of staring and pulling my hair out, I found the issues. I had installed multi-language support sometime ago (and due to the project changing, had to remove it). Apparently in my haste, I did not remove all the dependencies so it was still trying to check for the multi-language title (I am guessing) even though it actually wasnt on the page. I went through the database and removed it and can now save/publish pages without issues. 
    • By Noel Boss
      Hi everyone 🙌
      Is there a way to order the language tabs in the backend? Currently, they seem to be ordered based on the created date (or id?) …
      ( time passes … ⏰ 🚶‍♂️)
      Just answered my own question. One can reorder the languages in the page tree under admin » languages or directly in the DB » pages » template_id=54 » sord field.
      Anyone knows if there are side effects when moving the default language from sort 0 to somewhere higher?
  • Create New...