Source of file ContactWidget.php
Size: 2,789 Bytes - Last Modified: 2021-12-24T06:43:42+00:00
/var/www/docs.ssmods.com/process/src/code/ContactWidget.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 | <?php /** * @author marcokernler */ class ContactWidget extends Widget { /** * */ public static $db = array( "FrontendTitle" => "Varchar(255)", "Intro" => "HTMLText", "RenderWithMicroData" => "Boolean", "HideLogo" => "Boolean", "HideGenericImage" => "Boolean", "HideCompany1" => "Boolean", "HideCompany2" => "Boolean", "HideAddress" => "Boolean", "HideContact" => "Boolean" ); /** * */ public static $defaults = array(); /** * */ public static $title = "Kontakt-Widget"; /** * */ public static $cmsTitle = "Kontakt-Widget"; /** * */ public static $description = "Stellt die in den Seiteneinstellungen festgelegten Kontaktinformationen dar."; // - - - /** * */ public function Title() { $displayName = $this->widgetTitle ? $this->widgetTitle : self::$title; return $this->showTitle ? $displayName : ""; } /** * * */ public function getCMSFields() { return new FieldList( new TextField("FrontendTitle", "Frontend Title"), new TextareaField("Intro", "Einleitung"), new CheckboxField("RenderWithMicroData", "Adresse als Microdata rendern?"), new CheckboxField("HideLogo", "Logo ausblenden?"), new CheckboxField("HideGenericImage", "Allgmeines Bild ausblenden?"), new CheckboxField("HideCompany1", "Firma1 ausblenden?"), new CheckboxField("HideCompany2", "Firma2 ausblenden?"), new CheckboxField("HideAddress", "Adresse ausblenden?"), new CheckboxField("HideContact", "Kontaktdaten ausblenden?") ); } } /** * Class ContactWidget_Controller */ class ContactWidget_Controller extends WidgetController { /** * @return DataObject */ public function ContactInformations() { // checks for the active environment type, to load minified css and js files if in live mode if (Director::get_environment_type() == "dev" || Director::get_environment_type() == "test") { Requirements::css("widget_Contact/css/contactwidget.css"); } else { Requirements::css("widget_Contact/css/contactwidget.min.css"); } return SiteConfig::get()->First(); } /** * @return string */ public function HideLogo() { return strval($this->widget->HideLogo); } /** * @return string */ public function HideGenericImage() { return strval($this->widget->HideGenericImage); } /** * @return string */ public function HideCompany1() { return strval($this->widget->HideCompany1); } /** * @return string */ public function HideCompany2() { return strval($this->widget->HideCompany2); } /** * @return string */ public function HideAddress() { return strval(boolval($this->widget->HideAddress)); } /** * @return string */ public function HideContact() { return strval(boolval($this->widget->HideContact)); } } |