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):
- 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