processwire-issues icon indicating copy to clipboard operation
processwire-issues copied to clipboard

Formatted Text values ignore langBlankInherit

Open mpsn opened this issue 1 year ago • 2 comments

Short description of the issue

We've been using langBlankInherit=false to only display repeaters for languages where the title is set. As of 3.0.229 this no longer works while output formatting is active.

The only changes to language and textfields i could find were some minor refinements and some textformatting, but so far failed to see where exactly that option gets lost.

Old loop, ≤3.0.210

foreach($repeater as $item){
  # returning default language value as of 3.0.229
  $localtitle = $item->getLanguageValue($user->language, 'title');
  if(!$localtitle)
    continue; 
}

Workaround

foreach($repeater as $item){
  $of = $item->of(false);
  # yay - working again
  $localtitle = $item->getLanguageValue($user->language, 'title');
  if(!$localtitle)
    continue;
  $item->of($of);
}

mpsn avatar Jan 29 '24 17:01 mpsn

@mpsn I can't duplicate it here yet. Trying both $item->title and $item->getLanguageValue($user->language, 'title'); when set to a non-default language. With the inherit setting turned off, I just get a blank string when the value is blank for the tested language. I tried with both repeater items and regular pages. Is it possible that you have field/template context settings that might be overriding the langBlankInherit setting in your repeater?

ryancramerdesign avatar Feb 20 '24 17:02 ryancramerdesign

Yes, langBlankInherit is overriden in the repeater [matrix] field settings. By default its set to "use default language value", and overridden to "stays empty" for repeaters and matrix types which require single-language availability.

mpsn avatar Feb 26 '24 08:02 mpsn