예제 #1
0
파일: FlexSlider.php 프로젝트: vinstah/body
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName("Title");
     $fields->removeByName("animation");
     $fields->removeByName("easing");
     $fields->removeByName("direction");
     $fields->removeByName("reverse");
     $fields->removeByName("dynamicLoading");
     $fields->removeByName("animationLoop");
     $fields->removeByName("slideshow");
     $fields->removeByName("slideshowSpeed");
     $fields->removeByName("animationSpeed");
     $fields->removeByName("randomize");
     $fields->removeByName("showControlNav");
     $animationTypes = $this->dbObject("animation")->enumValues();
     $easingTypes = $this->dbObject("easing")->enumValues();
     $directions = $this->dbObject("direction")->enumValues();
     // Main
     $field_Title = new TextField("Title", _t("FlexSlider.Title"));
     $field_Title->setRightTitle(_t("FlexSlider.TitleDescription"));
     $field_slideshow = new CheckboxField("slideshow", _t("FlexSlider.slideshow"));
     $field_animationLoop = new CheckboxField("animationLoop", _t("FlexSlider.animationLoop"));
     $field_animation = new Dropdownfield("animation", _t("FlexSlider.animationType"), $animationTypes);
     $field_direction = new Dropdownfield("direction", _t("FlexSlider.direction"), $directions);
     $field_easing = new Dropdownfield("easing", _t("FlexSlider.easingType"), $easingTypes);
     $field_easing->setRightTitle(_t("FlexSlider.easingTypeDescription"));
     $field_slideshowSpeedvalue = !$this->ID ? FlexSlider::$defaults["slideshowSpeed"] : $this->slideshowSpeed;
     $field_slideshowSpeed = new NumericField("slideshowSpeed", _t("FlexSlider.slideshowSpeed"), $field_slideshowSpeedvalue);
     $field_slideshowSpeed->setRightTitle(_t("FlexSlider.slideshowSpeedDescription"));
     $field_animationSpeedvalue = !$this->ID ? FlexSlider::$defaults["animationSpeed"] : $this->animationSpeed;
     $field_animationSpeed = new NumericField("animationSpeed", _t("FlexSlider.animationSpeed"), $field_animationSpeedvalue);
     $field_animationSpeed->setRightTitle(_t("FlexSlider.animationSpeedDescription"));
     $field_randomize = new CheckboxField("randomize", _t("FlexSlider.randomize"));
     $field_showControlNav = new CheckboxField("showControlNav", _t("FlexSlider.showControlNav"));
     $FieldsArray = array($field_Title, $field_slideshow, $field_animationLoop, $field_animation, $field_direction, $field_easing, $field_slideshowSpeed, $field_animationSpeed, $field_randomize, $field_showControlNav);
     $fields->addFieldsToTab('Root.Main', $FieldsArray);
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeFieldFromTab("Root", "Sort");
     $fields->removeFieldFromTab("Root.Main", "AdvertisementImage");
     $fields->removeFieldFromTab("Root.Main", "AdvertisementImageID");
     $fields->removeFieldFromTab("Root.Main", "LinkedPageID");
     $fields->removeFieldFromTab("Root.Main", "ExternalLink");
     $fields->removeFieldFromTab("Root.Parents", "Parents");
     $fields->removeFieldFromTab("Root", "Parents");
     $fields->addFieldToTab("Root.Main", new ReadonlyField("Link"));
     $fields->addFieldToTab("Root.Main", $mainImageField = new UploadField($name = "AdvertisementImage", $title = $this->i18n_singular_name()));
     $mainImageField->setRightTitle(self::recommended_image_size_statement());
     $fields->addFieldToTab("Root.Main", $additionalImageField = new UploadField($name = "AdditionalImage", $title = $this->i18n_singular_name() . " " . _t("Advertisement.ADDITIONAL_IMAGE", "additional image")));
     $additionalImageField->setRightTitle(self::recommended_image_size_statement());
     if ($this->ID) {
         $treeField = new TreeMultiselectField("Parents", _t("Advertisement.GETCMSFIELDSPARENTID", "only show on ... (leave blank to show on all " . $this->i18n_singular_name() . " pages)"), "SiteTree");
         /*$callback = $this->callbackFilterFunctionForMultiSelect();
         		if($callback) {
         			$treeField->setFilterFunction ($callback);
         		}*/
         $fields->addFieldToTab("Root.ShownOn", $treeField);
     }
     $fields->addFieldToTab("Root.OptionalLink", $externalLinkField = new TextField($name = "ExternalLink", $title = _t("Advertisement.GETCMSFIELDSEXTERNALLINK", "link to external site")));
     $externalLinkField->setRightTitle(_t("Advertisement.GETCMSFIELDSEXTERNALLINK_EXPLANATION", "(e.g. http://www.wikipedia.org) - this will override an internal link"));
     $fields->addFieldToTab("Root.OptionalLink", new TreeDropdownField($name = "LinkedPageID", $title = _t("Advertisement.GETCMSFIELDSEXTERNALLINKID", "link to a page on this website"), $sourceObject = "SiteTree"));
     $fields->addFieldToTab("Root.OptionalLink", new CheckboxField($name = "RemoveInternalLink", $title = _t("Advertisement.RemoveInternalLink", "remove internal link")));
     if (class_exists("DataObjectSorterController")) {
         //sorted on parent page...
     } else {
         $fields->addFieldToTab("Root.Position", $sortField = new NumericField("Sort", _t("Advertisement.SORT", "Sort index number")));
         $sortField->setRightTitle(_t("Advertisement.SORT_EXPLANATION", "the lower the number, the earlier it shows"));
     }
     $fields->removeFieldFromTab("Root.Main", "AlternativeSortNumber");
     return $fields;
 }