ryan Posted May 4, 2018 Share Posted May 4, 2018 This week's version of ProcessWire on the dev branch continues resolution of GitHub issue reports, and it also adds a new text truncation function to our $sanitizer API, something requested from our requests repository: https://processwire.com/blog/posts/processwire-3.0.101-core-updates/ We didn't have a blog post for last week's version 3.0.100—see the core updates section in ProcessWire Weekly #207 for more details on that version. 17 Link to comment Share on other sites More sharing options...
adrian Posted May 4, 2018 Share Posted May 4, 2018 Thanks Ryan - this truncate method looks awesome - way to over-deliver 3 1 Link to comment Share on other sites More sharing options...
wbmnfktr Posted May 4, 2018 Share Posted May 4, 2018 There is a typo in your post @ryan. You write: Quote .. and it also adds a new text truncation function to our $sanitizer API ... The correct sentence should be: Quote ... and it also adds a new swiss-army-knife-like truncation function to our $sanitizer API But okay... I'm fine with your sentence, too. 4 Link to comment Share on other sites More sharing options...
Robin S Posted May 4, 2018 Share Posted May 4, 2018 Wow, that truncate function will truncate my search for the ultimate truncate function! ? I wonder if the default for the "visible" option should be true rather than false. If my string included entities and markup tags I think in nearly all cases I wouldn't want those invisible items affecting the visible string length. 4 Link to comment Share on other sites More sharing options...
ryan Posted May 6, 2018 Author Share Posted May 6, 2018 Quote I wonder if the default for the "visible" option should be true rather than false. If my string included entities and markup tags I think in nearly all cases I wouldn't want those invisible items affecting the visible string length. That's a good point, and maybe we'll change that before this gets off the dev branch. I left it false by default because it means a little more work for the function to perform. With defaults, I try and find a balance between the most likely to be used settings, with those that perform with the lowest overhead. There's also the matter of the "visible" option being more useful when the "keepTags" or "keepFormatTags" options are in use, where it can make a big difference. Though even without those options in use, there could still be entities counted as more than 1 character, so perhaps visible as true by default might be better. 2 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now