Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: ee()->publisher_site_pages->get() doesn’t completely follow lang ID parameter

Status Resolved
Add-on / Version Publisher 3.9.1
Severity
EE Version 6.4.2

Eric Swierczek

Jun 06, 2023

calling `ee()->publisher_site_pages->get($langId = 1, false)` when I’m currently saving an entry in language != 1 sets/returns `$site_pages[$this->siteId][‘url’] = ee()->config->slash_item(‘site_url’);` (line 941) which isn’t the url value I’d expect back, considering I called get() with a specific language ID. e.g. it returns

array(1) {
  [1]=>
  array(3) {
    ["url"]=>
    string(26) "https://local.site.com/de/"
    ["uris"]=>
    array(2) {
      [123]=>
      string(1) "/"
      [567]=>
      string(8) "/contact"

where `url` is for language 4, but `uris` is for language 1. When I call the function like `->get(4, false)`:

array(1) {
  [1]=>
  array(3) {
    ["url"]=>
    string(26) "https://local.site.com/de/"
    ["uris"]=>
    array(2) {
      [123]=>
      string(1) "/"
      [567]=>
      string(8) "/kontakt"

 

#1

BoldMinded (Brian)

Did you try the 3rd and 4th parameters, specifically the 4th param to refresh the cache?

#2

Eric Swierczek

Yes, the way I’m actually calling this is

ee()->publisher_site_pages->get(1, false, 'open', true);

but only the first 2 parameters seemed relevant in the logic of

get()
#3

BoldMinded (Brian)

For documentation, and so I’m clear and don’t forget this when I find time to look into this… in the middle of an entry save, calling ee()->publisher_site_pages->get(4, false, ‘open’, true); ends up returning the site pages data for English/default, instead of German? And you’re calling this function in your own extension using the publisher_entry_save_end hook?

#4

Eric Swierczek

Yes, calling this from the publisher_entry_save_end hook in my own extension. And the uris themselves are the translated versions, but the url value is the current language’s url, not following the $lang_id parameter. My test case was saving an entry in German, and then calling ->get() with the English language ID, so uris is correctly the English values, but url is still the German value. But saving an entry in English while calling ->get() with the German language ID should show the issue too (German uris but English url).

#5

BoldMinded (Brian)

Comment has been marked private.

#6

BoldMinded (Brian)

Eric, I’m marking this as resolved. If the issues still occurs with that latest build just reopen the ticket.

Login to reply