Questions tagged [silverstripe-4]

Silverstripe 4 is the latest major version of the Silverstripe open source CMS and framework. Version 4.0.0 was released on 8th Nov 2017.

For a high level overview of changes to Silverstripe 4 from Silverstripe 3 and an upgrade guide, see the 4.0.0 changelog.

316 questions
7
votes
3 answers

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

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…
Daniel H.
  • 412
  • 2
  • 12
6
votes
1 answer

Silverstripe table_name not set for class

I'm just learning SilverStripe and I'm having a problem with the lessons on the silverstripe website actually. I have this class: namespace SilverStripe\Lessons; use Page; class ArticlePage extends Page { private static $can_be_root =…
Bucephalus
  • 201
  • 2
  • 6
5
votes
1 answer

$Date.Format on Silverstripe 4 Template

I have a date in the database with this format "YY-mm-dd". On the template I want it in this format: dd.mm.YY Usually it would work with $date.Format('d.m.Y') But not in Silverstripe 4. It converts from 2018-05-08 to 8.0.2018. Only the year is…
Denis
  • 111
  • 1
  • 3
4
votes
1 answer

Recursive menu of all children

I am trying to generate a nested menu of all the pages in the site tree. The docs show two levels - I won't know how many levels there are. Currently I know there is at least four levels deep at one point so I have this:
    <% loop $Menu(1) %> …
polycode
  • 95
  • 6
4
votes
1 answer

Is there a way to add a custom "response" for boolean summary fields in Silverstripe model admin?

I want my booleans to give a more friendlier response then true/false. I have seen that I can do Boolan.Nice but that will give me yes/no. I have used: class AboutusGallery extends DataObject{ private static $db = [ 'Description' =>…
4
votes
0 answers

Silverstripe 4 doesn't find templates when using namespaces

Seems to be precious little info out there on how templates should be structured. I asked this question earlier but I think I can ask it better with code samples and remove my earlier attempt: mysite/_config/theme.yml SilverStripe\View\SSViewer: …
Aaryn
  • 1,337
  • 2
  • 15
  • 24
4
votes
1 answer

Silverstripe 4 - CSS and JS Requirements. How/what populates the /resources directory?

I have a SS3.x module that I have forked, pulled down from it's fork via composer, and started porting to SS4. So far so good, except when it comes to Requirements. I'm using the Requirements format found in existing code in another module, which…
Aaryn
  • 1,337
  • 2
  • 15
  • 24
3
votes
1 answer

SilverStripe: Adding the component to GridField grouping them in a div (toolbar)

I am working on a SilverStripe project. In my project, I am adding components to the GridField dynamically. Actually, I am trying to replace the existing components. Since there is no replace method, I have to remove the existing components and add…
Wai Yan Hein
  • 9,841
  • 21
  • 103
  • 244
3
votes
1 answer

Unable to customize filter/ search form of ModelAdmin in SilverStripe 4.4.4

I am working on a SilverStripe project. Basically, I updated my project to SilverStripe version 4.4.4. After the upgrade, I found out that the search/ filter forms of the ModelAdmin were changed as in the screenshot below. What I am trying to do…
Wai Yan Hein
  • 9,841
  • 21
  • 103
  • 244
3
votes
1 answer

SilverStripe ModelAdmin number of records per page for pagination is not working

I am working on a SilverStripe project. In my project, I am building a model admin class to display the list of records within the CMS. I am trying to limit the number of records rendered per page. So I put $page_length field in my model admin class…
Wai Yan Hein
  • 9,841
  • 21
  • 103
  • 244
3
votes
0 answers

Silverstripe 4 HTMLField (TinyMCE) is stripping inline style attributes on Save/Publish

I am trying to add a style attribute to an img tag in HTMLText markup view. But every time I save or publish, the attribute is stripped. I found this documentation ("Setting options" - about half way down). So tried that in my /app/_config.php file…
Aaryn
  • 1,337
  • 2
  • 15
  • 24
3
votes
1 answer

Is it possible to detect if a HTTPRequest is available?

Silverstripe Version: 4.2 I have a custom AssetAdapter that makes some changes to the filesystem based on the current request. I am using injector to get the request: $request = Injector::inst()->get(HTTPRequest::class); For the most part this…
PsychoMo
  • 559
  • 2
  • 16
3
votes
0 answers

SilverStripe 4 - large asset downloads exhausts memory_limit in HTTPStreamResponse.php

I have a client who has some large (1GB+) private assets in SilverStripe 4. It seems these files are stored in memory while they are streamed/downloaded via HTTPStreamResponse.php. This causes Allowed memory size exhausted errors unless I up the php…
LiveSource
  • 5,834
  • 4
  • 18
  • 19
3
votes
1 answer

SilverStripe ORM where clause on relations and its count

I am working on a SilverStripe project. Now I am querying the data. What I am trying to do is getting all the records running where clause on the count of its relations. The below query will get all the NewsPage records. NewsPage has many blogs. So,…
Wai Yan Hein
  • 9,841
  • 21
  • 103
  • 244
3
votes
1 answer

How to limit object access to $has_one Member in Silverstripe?

I'm working on a Silverstripe 4.3.1 project which has an object with an owner member attached via $has_one: class Object extends DataObject { private static $has_one = [ 'Member' => Member::class, ]; We want to limit the ability to…
BaronGrivet
  • 4,043
  • 5
  • 32
  • 49
1
2 3
21 22