Changeset 861

Show
Ignore:
Timestamp:
07/17/08 18:26:57 (5 months ago)
Author:
mpaschal
Message:

Convert choice list delimiters from linefeeds to commas

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/LinkedEntryCustomFields/plugins/LinkedEntryCustomFields/lib/LinkedEntryCustomFields/Convert.pm

    r860 r861  
    6262    } 
    6363    elsif ($field_type eq 'menu' || $field_type eq 'radio') { 
    64         # The choices are already comma-delimited. 
    65         # TODO: strip out the keys from key=value choices, as CF doesn't support those. 
    6664        $options = $field_data->{choices}; 
     65        # The choices are linefeed delimited, so convert them. 
     66        # TODO: prevent existing commas from becoming delimiters through judicious application of magic 
     67        $options =~ s{ 
     68            (?: = [^\r\n]* )?    # possible display value 
     69            (?: ([\r\n]+) | \z)  # linefeed or EOS 
     70        }{ $1 ? q{,} : q{} }xmsge; 
    6771    } 
    6872