[Rt-commit] rt branch, create-action, updated. c2114f82d7c50ff380e8b283f9ef070a0d570e0c

sartak at bestpractical.com sartak at bestpractical.com
Fri Sep 25 15:35:17 EDT 2009


The branch, create-action has been updated
       via  c2114f82d7c50ff380e8b283f9ef070a0d570e0c (commit)
      from  755dcafde477466ac9602bdc8e418a28f44af5b0 (commit)

Summary of changes:
 lib/RT/Model/CustomField.pm |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit c2114f82d7c50ff380e8b283f9ef070a0d570e0c
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Sep 25 15:34:58 2009 -0400

    First pass at CF->type_for_rendering

diff --git a/lib/RT/Model/CustomField.pm b/lib/RT/Model/CustomField.pm
index 627fe52..f7755e9 100755
--- a/lib/RT/Model/CustomField.pm
+++ b/lib/RT/Model/CustomField.pm
@@ -1209,4 +1209,31 @@ sub url_template {
     }
 }
 
+=head2 type_for_rendering
+
+This returns an appropriate C<render as> value based on the custom field's
+type.
+
+=cut
+
+sub type_for_rendering {
+    my $self = shift;
+    my $type = $self->type;
+
+    return undef if !$type;
+
+    my %type_map = (
+        Select       => 'Select',
+        Freeform     => 'Text',
+        Text         => 'Textarea',
+        Wikitext     => '',
+        Image        => '',
+        Binary       => 'Upload',
+        Combobox     => '',
+        Autocomplete => '',
+    );
+
+    return $type_map{$type};
+}
+
 1;

-----------------------------------------------------------------------


More information about the Rt-commit mailing list