public function getCMSFields() { $fields = new FieldList(); $internalLink = new TreeDropdownField("InternalLinkID", _t("Skitter.InternalLink", "Internal Link"), "SiteTree"); $fields->push(new TextField('Name', _t("Skitter.Name", "Name (internal name, not shown in public site)"))); $fields->push(new TextField('Label', _t("Skitter.Label", "Label"))); $fields->push(MaxSkitterDefaults::get_array_dropdown("animation")); $fields->push(new TextField('ExternalLink', _t("Skitter.ExternalLink", "External Link"))); $fields->push($internalLink); if ($this->InternalLinkID > 0) { $fields->push(new CheckboxField("forceToEmpty", "Remove internal LinkTo", false)); } $fields->push(new UploadField('MaxSkitterImage')); $this->extend('updateCMSFields', $fields); return $fields; }
public function get_skitter_config() { // Load static config $staticConfig = MaxSkitterDefaults::get_staticConfig(); // Load SiteConfig $siteConfig = SiteConfig::current_site_config(); // init final config $skitterConfig = array(); // loop for all config fields foreach (MaxSkitterDefaults::get_skitterConfigFields() as $key => $value) { // Db fields are prefixed $prefixed_key = MaxSkitterDefaults::$dbFieldsPrefix . $key; // isset any config for each field if (!empty($this->owner->{$prefixed_key}) || !empty($siteConfig->{$prefixed_key}) || isset($staticConfig[$key])) { if (!empty($this->owner->{$prefixed_key})) { $config = $this->owner->{$prefixed_key}; $place = "Page"; } else { if (!empty($siteConfig->{$prefixed_key})) { $config = $siteConfig->{$prefixed_key}; $place = "SiteConfig"; } else { $config = $staticConfig[$key]; $place = "_config"; } } if (is_array($value)) { $value = "Array"; } $skitterConfig[$key] = array('config' => $config, 'type' => $value, 'place' => $place); } } //debug if (MaxSkitterDefaults::$debugSkitter) { print_r($skitterConfig); } return $skitterConfig; }
public static function set_staticConfig($array) { self::$staticConfig = $array; }
function updateSettingsFields(FieldList $fields) { $fields->addFieldsToTab("Root.SkitterPageConfig", MaxSkitterDefaults::get_skitterCMSFields()); }