Problem/Motivation
Looking for a way to make Maxlength module work with description metatag field on per-node metatags.
Steps to reproduce
Have a client who:
A) Uses Maxlength module along with Text Summary Options on their body summary to require summary text with a soft limit of 160 chars
B) Uses body summary to populate the description metatag.
C) Exposes certain Metatag fields, like description metatag, on node edit forms to allow overrides.
D) Wants a consistent UI for the description metatag override field, with the maxlength module countdown indicator.
Effectively, they want to permit longer body summary text for teasers and card displays with the soft limit, but enforce a hard limit of 160 on the metatag override field.
Proposed resolution
My initial guess is that this is just a small hook_form_alter() away. But I haven't looked into maxlength module's form api integration yet. So I wanted to capture this support request here so others can either chime in with their recipe — if one exists — or we can discuss and document a solution.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | Screenshot 2023-06-23 at 09.53.36.png | 234.79 KB | jwilson3 |
| #15 | Screenshot 2023-06-23 at 09.53.26.png | 253.17 KB | jwilson3 |
| #15 | Screenshot 2023-06-23 at 09.53.11.png | 387.26 KB | jwilson3 |
| #6 | metatag-n3356420-6.patch | 4.78 KB | damienmckenna |
Comments
Comment #2
jwilson3Comment #3
damienmckennaLet's make this a feature request.
We have support in the module for allowing meta tags to have a maximum length, so let's leverage that on the form output.
In D7 Maxlength integration could be handled by setting some elements in the form definition, maybe the D9+ version has something similar?
Comment #4
damienmckennaComment #5
damienmckennaThis matches the changes from the D7 issue.
Comment #6
damienmckennaTypo on the settings form.
Comment #7
damienmckenna@jwilson3: Let me know if this would work, I'd be happy to include this in the next release if it does. FYI I tested it with Maxlength v2.1.1.
Comment #8
jwilson3Amazing! Thanks Damien for the first stab at this.
A read through of the patch looks good at first glance.
I'll take a closer look and test this week.
Comment #9
damienmckennaJames: Were you able to test it out? Does it cover what you were looking for?
Comment #10
papagrandeYes, this would be very useful. Works for me on a D9 site.
Comment #12
damienmckennaCommitted. Thank you both for your help with this.
Comment #15
jwilson3I can now confirm that this feature is working great on a D10 site. My apologies that I was unable to test this earlier. I really appreciate you making time to get this done Damien! Thank you!
Some screenshots:
Comment #16
jwilson3Found a spelling error "processsed" => "processed".
Will open a follow-up.