silverstripe-4

Silverstripe 4 error log

巧了我就是萌 提交于 2021-01-27 20:33:29
问题 How can I log errors to file log in SilverStripe 4? I mean all errors causing 'Internal server error' info from SS In SilverStripe it was : SS_Log::add_writer(new SS_LogFileWriter('/var/log/silverstripe/errors.log'), SS_Log::ERR); Documentation says that I need to do something like: SilverStripe\Core\Injector\Injector: Psr\Log\LoggerInterface: calls: LogFileHandler: [ pushHandler, [ %$LogFileHandler ] ] LogFileHandler: class: Monolog\Handler\StreamHandler constructor: - "../silverstripe.log"

How to add javascript to all pages in silverstripe cms via a module?

六月ゝ 毕业季﹏ 提交于 2020-07-10 10:25:30
问题 I am trying to create a module for silverstripe. I am going through https://docs.silverstripe.org/en/4/developer_guides/templates/requirements/#requirements to understand how to add javascript and css files to the front end pages. What I am not able to figure out is how to add a javascript file to all cms pages when the user installs my module. Is there a class I can extend and specify there? Or can it be done using the config somehow? 回答1: Create a class that subclasses SilverStripe\Core

SilverStripe 4 - Blank page on logging out

喜欢而已 提交于 2020-01-14 04:04:29
问题 As I stated here, I would allow pre-generated users to log out from a SilverStripe 4 website front-end page, by using the default from. Logging out because log in works. The problem is that if a logged generic user tries to log out by clicking on a link like Security/logout (as well as Security/logout?BackURL=home/ ), it being redirected to a blank page (just with header/footer visible, as the default Page.ss is implemented). Apparently the controller doesn't work or similar, because URL

I Can Not Remove The Default Drop Down of a $has_one in Silverstripe

一世执手 提交于 2020-01-05 07:43:34
问题 I have tried: removeFieldFromTab removeByName replaceField But the field persists. use SilverStripe\ORM\DataObject; use //..... class Product extends DataObject { private static $db = [ 'ProductName'=>'Varchar', 'TagLine'=>'Text', 'GeneralDescription'=>'HTMLText' ]; private static $has_one = [ 'SplashImage'=>Image::Class, 'ProductCategory'=>ProductCategory::Class ]; private static $has_many = [ 'ProductImage'=>Image::Class, 'Features'=>'Feature' ]; private static $owns = [ 'SplashImage',

Silverstripe File relation in ModelAdmin doesnt publish

。_饼干妹妹 提交于 2019-12-31 02:24:06
问题 Im using SilverStripe4 and the ModelAdmin to manage DataObjects. The DataObject has a has_one on File. Everything works so far but on frontend controller the File relation has an empty object. I see that the file is not in the File_Live table, so i guess its not published and therefor its not found on the frontend controller. How can i publish File relations from the ModelAdmin? Basically when a file is uploaded it should be automatically published. I guess if i use versioned DataObjects i

Is there a better way to write the function for my carousel dataobject in my footer

亡梦爱人 提交于 2019-12-24 18:54:26
问题 I have a dataobject that I use on my IndexPage page which works fine in its footer but it does not render on my other pages in the footer. This is what I have tried so far in the default CWP PageController page and has made the data disappear from the index page (my IndexPage is extended by the CWP Page template): ```<?php namespace SilverStripe\IndexPage; use Page; use SilverStripe\CMS\Model\SiteTree; use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField

SilverStripe 4.1 - SS_DEFAULT_ADMIN_USERNAME and PASSWORD not respected

半腔热情 提交于 2019-12-24 00:56:56
问题 I have a SilverStripe 4.1 site (upgraded from 3.4) running on an Ubuntu Vagrant VM. I have the following .env file: # Default Admin SS_DEFAULT_ADMIN_USERNAME="admin" SS_DEFAULT_ADMIN_PASSWORD="password" # DB credentials SS_DATABASE_CLASS="MySQLPDODatabase" SS_DATABASE_SERVER="127.0.0.1" SS_DATABASE_USERNAME="user" SS_DATABASE_PASSWORD="pass" SS_DATABASE_NAME="silverstripe" # environment SS_ENVIRONMENT_TYPE="dev" The site otherwise works, and complains when .env is deleted, so it's being read

How to automaticaly publish files uploaded to a dataobject in Silverstripe model admin

北慕城南 提交于 2019-12-23 09:27:51
问题 In Silverstripe 4 a file that is uploaded must be published before it is visible to the public side of the site. If I create a $Page with a $has_one Image::Class and then also assign that image to $owns[] the uploaded image will be published when I publish the page. However If I create the following data object structure it will not. Class Item extends DataObject{ $has_one[ 'ItemImage'=>Image::Class, 'Catalog'=>'Catalog' ]; $owns[ 'ItemImage' ] } Class Catalog extend DataObject{ $has_many[

Silverstripe 4: Member Login and Redirect to specific page

萝らか妹 提交于 2019-12-13 18:31:33
问题 I'd like to redirect Members who have successfully logged in to specific pages based on the group to which they belong. In the past I've been able to do this in SS3 with the following: CustomLoginForm.php: class CustomLoginForm extends MemberLoginForm { public function dologin($data) { // Redirect functionality here } } /mysite/_config.yml: Injector: MemberLoginForm: class: CustomLoginForm However, this approach does not work Silverstripe 4. I have tried: As above, creating a CustomLoginForm

Enable FullTextSearch in Silverstripe 4

穿精又带淫゛_ 提交于 2019-12-13 03:46:33
问题 In Silverstripe 4 FulltextSearchable::enable(); fails in _config.php Does anyone know how to get this working again so that $SearchForm works in templates? 回答1: Use \SilverStripe\ORM\Search\FulltextSearchable::enable(); in _config.php not FulltextSearchable::enable(); 来源: https://stackoverflow.com/questions/54068647/enable-fulltextsearch-in-silverstripe-4