Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Can you add the ability to automatically output text in all uppercase or all lowercase letters just like you can in CSS?
Comment | File | Size | Author |
---|---|---|---|
#12 | signwriter-623414.patch | 3.8 KB | teezee |
#10 | signwriter-textcase.patch | 2.56 KB | teezee |
#8 | signwriter-uppercase-623414.patch | 3.82 KB | kla2t |
Comments
Comment #1
kla2t CreditAttribution: kla2t commentedsubscribe
Comment #2
pimsn CreditAttribution: pimsn commentedsubscribe
Comment #3
alextronic CreditAttribution: alextronic commentedsubscribe
Comment #4
Maux CreditAttribution: Maux commentedsubscribe
Comment #5
drupahell CreditAttribution: drupahell commentedsubscribe
Comment #6
JonesUI CreditAttribution: JonesUI commentedI would like to see this feature as well.
Thanks!
Comment #7
MethodDan CreditAttribution: MethodDan commentedI really need this feature as well, subscribing :)
Comment #8
kla2t CreditAttribution: kla2t commentedSomeone just had to do it ... Here is a patch, but please be indulgent cause it's my first one.
It applies to uppercase transformation only, but if someone really needs lowercase transformation, it would be easily extendable.
Comment #9
teezee CreditAttribution: teezee commentedWouldn't it be better to support BOTH upper AND lowercase, like the title of the issue suggests?
I think it's very easy to achieve based on kla2t's patch (#8). Instead of a form item called 'upper case' it could contain a set of radio buttons:
+ $form['general']['text_case'] = array(
+ '#type' => 'radios',
+ '#title' => t('Case transform'),
+ '#default_value' => _signwriter_get_val($p, 'text_case', 0),
+ '#description' => t('Whether to transform the text case to lowercase or uppercase.'),
+ '#options' => array(t('Do not transform'), t('Transform to uppercase'), t('Transform to lowercase')),
+ );
Then, text_case = 1 means uppercase and text_case = 2 means lowercase.
I'll post an updated patch within an hour.
Comment #10
teezee CreditAttribution: teezee commentedUpdated patch is based on patch provided by kla2t at #8 but:
- Allows UPPER or lowercase text transformation
- Uses drupal_strtolower() and drupal_strtoupper() instead of strtolower() beacause Drupal's upper/lowercase functions are multibyte-safe (UTF-8 characters)
Comment #11
JonesUI CreditAttribution: JonesUI commentedI was not able to apply the patch from #10 to 6.x-2.0-beta1, 6.x-2.0-beta2 or 6.x-2.x-dev...
patch < signwriter-textcase.patch
patching file signwriter.admin.inc
patching file signwriter.install
Hunk #2 FAILED at 323.
1 out of 2 hunks FAILED -- saving rejects to file signwriter.install.rej
patching file signwriter.module
Comment #12
teezee CreditAttribution: teezee commentedRerolled changes against 6.x-2.x-dev, hope this works.
Comment #13
smoothify CreditAttribution: smoothify commentedThis patch applies and works for me - Thanks.