cookieconsent::initialize_widget (public)

 cookieconsent::initialize_widget [ -subsite_id subsite_id ]

Defined in packages/cookie-consent/tcl/cookie-consent-procs.tcl

Initialize a cookie-consent widget.

Switches:
-subsite_id (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 test_cookie_consent__setup cookie_consent__setup (test cookie-consent) cookieconsent::initialize_widget cookieconsent::initialize_widget test_cookie_consent__setup->cookieconsent::initialize_widget ad_conn ad_conn (public) cookieconsent::initialize_widget->ad_conn ad_get_cookie ad_get_cookie (public) cookieconsent::initialize_widget->ad_get_cookie cookieconsent::add_to_page cookieconsent::add_to_page (public) cookieconsent::initialize_widget->cookieconsent::add_to_page cookieconsent::get_relevant_subsite cookieconsent::get_relevant_subsite (private) cookieconsent::initialize_widget->cookieconsent::get_relevant_subsite parameter::get parameter::get (public) cookieconsent::initialize_widget->parameter::get callback::subsite::page_plugin::impl::cookie-consent callback::subsite::page_plugin::impl::cookie-consent (private) callback::subsite::page_plugin::impl::cookie-consent->cookieconsent::initialize_widget

Testcases:
cookie_consent__setup
Source code:
        if {![ns_conn isconnected]} {
            #
            # If the connection is already closed, do nothing.
            #
            return
        }

        if {$subsite_id eq ""} {
            set subsite_id [get_relevant_subsite]
        }

        set enabled_p [parameter::get  -package_id $subsite_id  -parameter CookieConsentEnabled  -default 0]
        #
        # Just do real initialization, when the cookie is NOT set.
        # When more complex interactions are defined, this has to be
        # reconsidered.
        #
        set cookie_set [ad_get_cookie "cookieconsent_status-$subsite_id" ""]

        if {$enabled_p && $cookie_set eq "" && ![ad_conn bot_p]} {
            #
            # Create an instance of the consent widget class from all configuration options
            #
            foreach {param default} {
                ExpiryDays     365
                Layout         block
                Palette        oacs
                Position       bottom
                LearnMoreLink  https://cookiesandyou.com/
                DefaultPalette "popup {text #fff background #004570} button {text #000 background #f1d600}"
            } {
                set p($param) [parameter::get  -package_id $subsite_id  -parameter CookieConsent$param  -default $default]
            }

            set c [CookieConsent new  -subsite_id      $subsite_id  -expiryDays      $p(ExpiryDays)  -position        $p(Position)  -palette         $p(Palette)  -layout          $p(Layout)  -learn-more-link $p(LearnMoreLink)  -default-palette $p(DefaultPalette)  ]
            #
            # ... and add it to the page
            #
            add_to_page -version "" $c
            $c destroy
        }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: