Can you add the ability to automatically output text in all uppercase or all lowercase letters just like you can in CSS?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kla2t’s picture

subscribe

pimsn’s picture

subscribe

alextronic’s picture

subscribe

Maux’s picture

subscribe

drupahell’s picture

subscribe

JonesUI’s picture

I would like to see this feature as well.

Thanks!

MethodDan’s picture

I really need this feature as well, subscribing :)

kla2t’s picture

Status: Active » Needs review
FileSize
3.82 KB

Someone 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.

teezee’s picture

Wouldn'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.

teezee’s picture

FileSize
2.56 KB

Updated 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)

JonesUI’s picture

I 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

teezee’s picture

FileSize
3.8 KB

Rerolled changes against 6.x-2.x-dev, hope this works.

smoothify’s picture

This patch applies and works for me - Thanks.