Jump to content

Page Reference Field do not activate secondary languages when creates a new page


Recommended Posts

I'm using the Page Reference Field in a multilanguage Site. When the admin creates a new page through the field option on the template, the page is created without activate the secondary language.

I've found this pretty old workaround (that works):

https://github.com/ryancramerdesign/ProcessWire/issues/889

(in the current version, the hook goes on the row 884 of InputfieldPage.module):

// ======================================================
// Hook to create new pages with languages active :
// ======================================================
   $trimmed_title = trim($title);
   $languages = wire("languages");
   foreach($languages as $lang) {
        $page->title->setLanguageValue($lang, $trimmed_title);
        $page->set("status$lang", 1);
   }
// ======================================================

I wonder if I'm making any mistake and there is some lost configuration. 

I suggest to enable the possibility to give the multilanguage field for the title when creating a new page through the page reference field.

(I'm using ProcessWire 3.0.123)

thanks

Alex

Link to comment
Share on other sites

@alemachado

processInputAddPages is a hookable method, so you can make a hook without modifying the core.

Also, make sure that all languages are active on parent page where you add pages from the page reference field, I'm not sure that it gonna help/

  • Like 1
Link to comment
Share on other sites

  • 8 months later...

I have the same issue, but I also noticed another problem:

Initially I had Italian as main language, but I switched to English as main one. Now the new pages created by PageReference are created with the name "untitled-xxxxxxxxxxxxx" (xxx = a series of number) and they have no Italian title so the page has an error cause it is missing the main title.

Does anyone know if I am missing some steps or should I also look into processInputAddPages?

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
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...