Jump to content

Recommended Posts

Posted

If I enable the addable field (create new) on a page field, and the client works in a non-default language. When the

new page is saved, it only has a value in the clients language for the title field. The default language value is blank and

shows a date for the title when I see the page in the admin lists from my account which is in english/default. Also

the title is treated as blank when traversing an array of pages. Is there some way to either copy a non-default language value

into default on a page save ( I actually have a module in development to try to do this but don't have the time at the moment and my

module development skills are primitive at best) when the default is blank, or , use another language when the default value is blank? Maybe designate language priorities for usage?

tia

lloop

Posted

I temporarily fixed it by adding this to wire/modules/Inputfield/InputfieldPage/InputfieldPage.module

On line 505, in ___processInputAddPages, I added :

// ======================================================
$trimmed_title = trim($title);
$languages = wire("languages");
foreach($languages as $lang) {
    $page->title->setLanguageValue($lang, $trimmed_title);
    $page->set("status$lang", 1);
}
// ======================================================

For future reference this is in PW 2.5.2.

I attempted to create a temporary module that replaces ___processInputAddPages by using 

"$event->replace = true;" but replacing the method entirely has issues with the reference to $this.

I hate to edit the PW-wire code. If someone can clue me in on how to deal with the $this reference

when replacing a method entirely, I would be forever grateful.

l

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.
×
×
  • Create New...