I have searched the issue queue here and not found a similar issue, please trash if already a duplicate or what ever other filter it fails.

Under "Output this field as a link" we now have the option to "Replace spaces with dashes" I did back flips! But I am sorrily missing Transform Case upper / lower.

I don't know if this is small over site or something that was explicitly kicked to the curb.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lathan’s picture

Status: Active » Needs review
FileSize
0 bytes

Here is a patch that works.

Followed the logic and pattern thats behind the argument case transformation way of handling this.

lathan’s picture

Arrrg here is the correct patch file.

lathan’s picture

closed duplicate issue http://drupal.org/node/1180820

I need to rerole this patch as I was not getting

switch ($this->options['alter'][$option])

to work for me, so I changed that to

switch ($option)

In any case we have two candidates.

dawehner’s picture

Status: Needs review » Needs work

Powered by Dreditor.

+++ b/handlers/views_handler_field.incundefined
@@ -1037,7 +1053,30 @@ If you would like to have the characters %5B and %5D please use the html entity
+        } else {
+          return ucwords($string);
+        }

Can you fix the code style of else {} and the whitespaces? This would be cool.

Powered by Dreditor.

lathan’s picture

Fixed white space and issue with switch and parameter passed along, as well as the else code style.

Here is the adjusted patch of latest dev branch.

lathan’s picture

Status: Needs work » Needs review

status change

dawehner’s picture

Status: Needs review » Needs work
+++ b/handlers/views_handler_field.incundefined
@@ -1085,6 +1126,10 @@ If you would like to have the characters %5B and %5D please use the html entity
+      $path = $this->case_transform($path, 'case');

Can't we give case_transform $this->options['alter']['case']

This would be much more elegant/reusable/testable/orthogonal

Sorry but this seems to be for much better.

Powered by Dreditor.

lathan’s picture

Followed really what is happening else where as in views_handler_argument_string.inc we have.

$this->argument = $this->case_transform($this->argument, 'case');

and

return $this->case_transform(parent::summary_name($data), 'case');

It depends where we want "$this->options['alter']['case']" in the switch or on the parameter?

dawehner’s picture

From my perspective in the parameter.

lathan’s picture

Status: Needs work » Needs review
FileSize
3.58 KB

Super here it is and removed some more white space i missed need "Dreditor" white space highlighter for textedit!

mstrelan’s picture

$this->case_transform() needs to occur before if (!empty($alter['replace_spaces'])) otherwise ucwords() won't work.

Please also review my patch from #1180820: Option to transform link paths to lower case which seems to work for me
http://drupal.org/files/issues/views-rewrite-link-case-transform-path.patch

lathan’s picture

@mstrelan nice catch I missed that here is the patch re-rolled.

mstrelan’s picture

I would also suggest using the key "path_case" instead of "case" for 2 reasons - consistency with the string argument handler and disambiguation since it is only the path that is having its case transformed.

You also don't need the text "Do not use this unless with Postgres as it uses case sensitive comparisons." in the description as there is no database interaction here.

If you make these two changes your patch would be pretty much identical to mine, except for the the code cleanup dereine asked for which you didn't introduce.

lathan’s picture

re-rolled, with mstrelan's suggestion.

lathan’s picture

missed description srry.

mstrelan’s picture

Status: Needs review » Reviewed & tested by the community

Patch in #15 looks good and works well. +1 for commit.

dawehner’s picture

Here is a small improvement: Move case_transform to views_handler so other handlers like filters can use it as well.

lathan’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/includes/handlers.incundefined
@@ -288,6 +288,44 @@ class views_handler extends views_object {
+   *      - ucwords: Make the first word in the string uppercase.

Small update on the description "ucwords: Make the each word in the string uppercase."

Powered by Dreditor.

dawehner’s picture

Status: Needs work » Needs review
FileSize
4.51 KB

You are right, here is a new version.

lathan’s picture

@dereine patch 1180510-views-3.x-transform-case-6.patch in #17 or #19 is not working its not transforming any case.

lathan’s picture

Here is a working version with dereine's refactoring in-place.

lathan’s picture

Hmm further testing and the refactoring is affecting the arguments now incorrectly. In my case I tested the following.

I have argument in that is coming in from the path.

- Added a lowcase trasformation on the argument "Case Path" [seems to be working]
- Added a Upper Case word trasformation on the argument "Case" [failing]
- Added a lowcase trasformation on the field. [working]

I think its down to this line in views_handler_argument_string.inc thats causing my second step above to fail.

    $this->argument = $this->case_transform($this->argument, 'case');
lathan’s picture

Sorry for the 'spam' figured it out and have tested this thoroughly.

Please just check my logic is sound on views_handler_argument_string.inc this was causing the issue in #22 'case' is now $this->options['case']

    function title() {
    $this->argument = $this->case_transform($this->argument, $this->options['case']);
    if (!empty($this->options['transform_dash'])) {
      $this->argument = strtr($this->argument, '-', ' ');
    }
  function summary_name($data) {
    return $this->case_transform(parent::summary_name($data), $this->options['case']);
  }
lathan’s picture

bump

lathan’s picture

Status: Needs review » Reviewed & tested by the community

Been running the last patch for a while with no issues changing status

mstrelan’s picture

Patch no longer applies. Here is a reroll against 7.x-3.x-dev for 2011-Jun-18

mstrelan’s picture

Actually, these are pretty much identical. Not sure why it didn't apply for me. Use #23 as mine has an extra whitespace.

lathan’s picture

anyone willing to review this?

merlinofchaos’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed to 7.x-3.x with hash f86c759 -- perhaps this should be backported to 6.x-3-x? It doesn't cherry-pick cleanly, but I expected that.

lathan’s picture

Assigned: Unassigned » lathan

I'll get to it next gap here.

Jorrit’s picture

Status: Patch (to be ported) » Needs review
FileSize
4.91 KB

I have ported the patch to 6.x-3.x. Most edits were the same, I only added '#process' => array('views_process_dependency'), to the options_form part.

Letharion’s picture

Assigned: lathan » merlinofchaos
chadsten’s picture

Version: 6.x-3.x-dev » 7.x-3.0-rc3

I think this is related:

Currently, Contextual Filters support transformation to lowercase, and replacing spaces with dashes. Using something like Title, this is a common filter to apply. It seems that there is no native way to apply the same transformation to Fields.

Is this for a specific reason, or has this been covered in a patch that hasn't been committed to the current repo? I use views_php for this currently, but I figure this would be super helpful to be in Views.

Thanks!

dawehner’s picture

Version: 7.x-3.0-rc3 » 6.x-3.x-dev

Please open a new issue, this issue is about the backport. Everything else makes the issue hard to get.

MustangGB’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)