template::util::richtext::get_property (public)

 template::util::richtext::get_property what richtext_list

Defined in packages/acs-templating/tcl/richtext-procs.tcl

Get a property of the richtext datatype. Valid properties are:

Parameters:
what (required)
the name of the property. Must be one of:
  • contents (synonyms content, text) - returns the actual contents of the textarea field
  • format (synonym mime_type) - returns the mimetype, e.g. 'text/plain'
  • html_value - returns the content converted to html format, regardless of the format the content is actually in. In case it is already text/html no conversion will be applied.
richtext_list (required)
a richtext datatype value, usually created with ad_form.

Testcases:
No testcase defined.
Source code:
    lassign $richtext_list contents format

    switch -- $what {
        content - contents - text {
            return $contents
        }
        format - mime_type {
            return $format
        }
        html_value {
            if { $contents ne "" } {
                return [ad_html_text_convert -from $format -to "text/html" -- $contents]
            } else {
                return {}
            }
        }

        default {
            error "Parameter supplied to util::richtext::get_property 'what' must be one of: 'contents', 'format', 'html_value'. You specified: '$what'."
        }
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: