There is not configuration for converting case for text in text effect module. This will be helpful if we use a token and need to convert in case.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | text-case-conversion-2690337-6.patch | 2.1 KB | Ajithlal |
| #3 | text-case-conversion-2690337-3.patch | 1.9 KB | Ajithlal |
Comments
Comment #2
fietserwinThough I can understand the feature request, I doubt if we should add it to the UI, because case conversion comes in many styles: all uppercase, all lowercase, headline style (leaving out simple short words like 'the', 'and', 'a' or not), only first letter.
However, what we could do is introduce some alter hook that passes in the $image and $data variables from the effect and that allows to change the params to your liking. it should be called when the effect function has done its own work on the params but before starting to use them to calculate offsets and such (line 329 of image_effects_text\image_effects_text.inc).
If you provide a patch I will review and eventually commit it.
Comment #3
Ajithlal commentedPlease find the patch attached. Included four types of case conversion.
Comment #4
Ajithlal commentedComment #5
fietserwinOK, so you want to go with a UI, let's do that.
Can you change all usages of textcase to text_case?
Please have a look at ctools\includes\stylizer.inc where you will find a similar form control. If you use the same wording (and case) for the field and the options, there will be less new translations. But please keep the default value the 1st one (thus do not add an empty option like stylizer does).
- typo: Convert.
- do not use 'format' but 'case'.
- do not use 'input text' but 'the text'.
Add the default option to the $defaults at the start of the function, so you don't have to check here if it is set or not.
This gave me a Notice: Undefined index: textcase in image_effects_text_get_text() (line 742 of image_effects_text.inc). Use isset(...) ? : and give it the default value.
Comment #6
Ajithlal commentedChanges are done. Stylizer doesn't have a sentence case conversion. I also included that.
Comment #8
fietserwinThanks, added and committed.
I did a new search if this feature was implemented anywhere else and found module://views/handlers/views_handler_argument_string.inc (line 64) and module://views/includes/handlers.inc (line 340). I liked the wording over there: clearer but still short, so I decided to go for that solution. but to not have to define a dependency on Views, I copied the method case_transform() to this module.
Comment #9
Ajithlal commentedThanks !. Works fine