ryancramerdesign / PageListCustomChildren

Makes children/subpages in PageList customizable so they can appear under multiple parents.
1 stars 0 forks source link

Title cut of #1

Open matjazpotocnik opened 1 month ago

matjazpotocnik commented 1 month ago

Hi, Ryan!

I'm evaluating this module and come to a funny situation: when a module is active, the title of the parent is changed. Pictures say more than a thousand words. This is my page structure: image Take a note of the title: it's "Mini-Jobber (gross <= 450 €/month)".

In the PageListCustomChildren module settings, I have this:

image

My page matching selector is a page with a template of basic-page, that is the page with the title "Mini-Jobber (gross <= 450 €/month)". The path for this page is /stiri/. For the children selector, I'm using OR group, combining the children from two parents: the first parent is /izvajalci/ and the second parent is /stiri/. So, idea is to show children of this page plus additional children from another parent. It works, but take a look of the title:

image

The title is cut off and is missing this part "<= 450 €/month)"! Is it possible that this has something to do with this long-standing issue? https://github.com/processwire/processwire-issues/issues/1111 ?

ryancramerdesign commented 1 month ago

Hi Matjaž, the module doesn't get involved with the page titles/labels at all, so I'm not yet sure about the source. So far I can't duplicate it here either. But we'd usually expect to see that if a strip_tags() takes place before a htmlspecialchars(). Though it's a bit of a catch 22 because if you reverse the order (or omit the strip_tags), then the HTML tags themselves get encoded and visible in the label, which I know has been reported as an issue as well. Since I'm not seeing the issue here, I'm wondering if the strip_tags (as used by sanitizer.text) might behave differently according to localization or something. One idea is ProcessPageList could maybe replace <= with ≤ and similar UTF8 replacements for others, when a "<" sign appears with a space or equals after it, or a ">" appears without a prior "<".

On Sun, Jul 14, 2024 at 5:15 PM Matjaž Potočnik @.***> wrote:

Hi, Ryan!

I'm evaluating this module and come to a funny situation: when a module is active, the title of the parent is changed. Pictures say more than a thousand words. This is my page structure: image.png (view on web) https://github.com/user-attachments/assets/eb8d5be1-dd13-482c-a7f5-4c03b9ca46d9 Take a note of the title: it's "Mini-Jobber (gross <= 450 €/month)".

In the PageListCustomChildren module settings, I have this:

image.png (view on web) https://github.com/user-attachments/assets/2693d52f-073b-4b86-bfee-75379f4f0c28

My page matching selector is a page with a template of basic-page, that is the page with the title "Mini-Jobber (gross <= 450 €/month)". The path for this page is /stiri/. For the children selector, I'm using OR group, combining the children from two parents: the first parent is /izvajalci/ and the second parent is /stiri/. So, idea is to show children of this page plus additional children from another parent. It works, but take a look of the title:

image.png (view on web) https://github.com/user-attachments/assets/11c76cf3-99a6-4ca1-8189-95b3900aa316

The title is cut off and is missing this part "<= 450 €/month)"! Is it possible that this has something to do with this long-standing issue? processwire/processwire-issues#1111 https://github.com/processwire/processwire-issues/issues/1111 ?

— Reply to this email directly, view it on GitHub https://github.com/ryancramerdesign/PageListCustomChildren/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACQEUC7NS7RPIAFQSMGXU3ZMLS53AVCNFSM6AAAAABK3O3GIWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQYDONJZHA3DINY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

matjazpotocnik commented 1 month ago

So, I changed the line

$value .= htmlspecialchars(strip_tags("$v"), ENT_QUOTES, "UTF-8", false);

to

$value .= htmlspecialchars("$v", ENT_QUOTES, "UTF-8", false);

in ProcessPageListRender.php, and the issue is fixed (and this also fixes #1111).

I found these issues that mention strip_tags:

https://github.com/processwire/processwire-issues/issues/104 https://github.com/processwire/processwire-issues/issues/854 https://github.com/processwire/processwire-issues/issues/1481 https://github.com/processwire/processwire-issues/issues/1205 https://github.com/processwire/processwire-issues/issues/1932

I agree with schwarzdesign comment and would remove strip_tags, but I understand your concern. Maybe it could be configurable?