template::util::richtext::initialize_widget (public)

 template::util::richtext::initialize_widget [ -form_id form_id ] \
    [ -text_id text_id ] [ -editor editor ] [ -options options ]

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

Initialize a single text input (textarea with the id "text_id" part of a form with "form_id") for the specified richtext editor via a richtext-editor plugin (e.g. ckeditor4, tinymce, or xinha)

Switches:
-form_id (optional)
ID of the form containing the textarea
-text_id (optional)
ID of the textarea
-editor (optional)
Editor, which should be used. Will default to that specified in acs-templating RichTextEditor parameter when not specified.
-options (optional)
Options passed in from the widget spec
Returns:
On success, this function returns a dict with success 1

Partial Call Graph (max 5 caller/called nodes):
%3 template::widget::richtext template::widget::richtext (public) template::util::richtext::initialize_widget template::util::richtext::initialize_widget template::widget::richtext->template::util::richtext::initialize_widget apm_package_id_from_key apm_package_id_from_key (public) template::util::richtext::initialize_widget->apm_package_id_from_key parameter::get parameter::get (public) template::util::richtext::initialize_widget->parameter::get template::util::richtext::require_editor template::util::richtext::require_editor (private) template::util::richtext::initialize_widget->template::util::richtext::require_editor

Testcases:
No testcase defined.
Source code:
    if {$editor eq ""} {
        set package_id_templating [::apm_package_id_from_key "acs-templating"]
        set editor [::parameter::get  -package_id $package_id_templating  -parameter "RichTextEditor"  -default "xinha"]
    }

    if {![require_editor -editor $editor]} {
        return {success 0}
    }

    #
    # The actual richtext-editor implementation may provide some
    # use-case based presets. Examples may be a "minimal", "standard"
    # and "advanced" configuration that are reused in various forms.
    #
    # Here, we check and eventually return such conf, which will be
    # applied to the loading formfield.
    #
    # When no preset was specified, we will try to look for the
    # "standard" preset. This provides a hook for site-wide
    # customization via a tcl proc, which enables to inject
    # e.g. information coming from the connection context or other tcl
    # commands, not possible via parameter alone.
    #
    # The purpose of this feature is to have a set of logical
    # configurations that do not depend on the specific editor and
    # can be extended downstream.
    #
    if {[dict exists $options preset]} {
        set preset [dict get $options preset]
    } else {
        set preset "standard"
    }
    if {[info commands ::richtext::${editor}::preset::${preset}] ne ""} {
        set options [dict merge  [::richtext::${editor}::preset::${preset}]  $options]
    }

    set result {success 1}
    lappend result {*}[::richtext::${editor}::initialize_widget  -form_id $form_id  -text_id $text_id  -options $options]
    return $result
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: