Based on the GridFieldConfig_RelationEditor, just remove GridFieldAddNewButton then add GridFieldAddNewMultiClass. Then configure the component to know which classes to have available in the dropdown to create. All those SectionThemesBlock, SectionFeaturedCourse etc extend a common Section dataObject as base. The get_section_type() function is a custom static function on the Section dataobject to get a nice looking name in the dropdown and not have to type it manually all the time....

Related:

php,sorting,grouping,silverstripe
I'm trying to loop through all my ProductPages while grouping them by their grandparent's title (as this is the product category). I would also like to sort the product pages under each group by their ProductReleaseDate descending. Finally if possible, any that do not have a ProductReleaseDate to be listed...

silverstripe
I'm having some trouble finding my /mysite/ folder - I'm trying to edit my _config.php file so I can add some schema to a website however, there is no /mysite/ folder. Is it possible it was renamed something else, or simply doesn't exist? Is there a way I can find...

forms,silverstripe
The Page Layout template for the "simple" theme (the default) contains: <% include SideBar %> <div class="content-container unit size3of4 lastUnit"> <article> <h1>$Title</h1> <div class="content">$Content</div> </article> $Form $CommentsForm </div> Where does the value of $Form come from? ie to make use of it, what do I need to do? Is it...

php,silverstripe
I'm adding a custom drop down to the userform module and everything seemed to work, however: If I set the following: [Textfield One] - Dropdown option one [Textfield Two] - Dropdown option two It seems to only save the the setting under Textfield One, and ignores Textfield Two. If I...

php,silverstripe
I'm trying to upload images in Silverstripe and have them treated as images rather than a document link. I've added SVG to the allowed filetypes and can upload an SVG file but when I hit insert the editor inserts the tag as <a href="/assets/uploads/somefile.svg">somefile.svg</a> I would like to treat SVG...

silverstripe
In my Silverstripe module I use $managed_models to create tabs on the right top, see here: My code: private static $managed_models = array( 'HomeRental', 'City', 'HomeType' ); How can I translate the name of this tabs? I use the Silverstripe-translate module as well. Thanks in advance!...

silverstripe
The code below is a custom report I'm putting together, using SilverStripe 3.1. The Title and ClassName values are working fine, but though I can get the Status for each Page I'm not sure how to set the Status value against each Page in the DataList. How can I do...

silverstripe
I have a site which I've just updated from 2.4 -> 3.1. On my local environment everything works fine, but once uploaded to production the search filters on GridFields do not work. No errors that I can see, they just don't filter anything. Has anyone come across this? class Product...

php,encryption,passwords,sha1,silverstripe
i have a DB of users and their password in encrypted form. I want to let the users log in to the site using the username and password. For authentication i need to know what type of encryption is their so that i can match the entered password with the...

class,configuration,silverstripe
I have a class extending DataObject, let's call it ExtendedDataObject, that I want to have a single config setting for; in particular, an email address. ie I want to store one email address for the class, not one per instance. If I have multiple classes extending my ExtendedDataObject, then each...

tinymce,silverstripe
Admins and editors on one of my sites wants to include some javascript embeds like twitter, facebook, instagram or whatever, on pages. I thought it would be really easy to just set the extended_valid_elements to allow the script tag in the html editor of tinyMCE, but it apparently doesn't work....

hyperlink,silverstripe
I'm very new to Silverstripe (3.1). I am using it to collect applications from users. Each user uploads a file which later in the CMS somebody can download. There is a has_one relationship for the file called 'Document.' I want to link to that file inside a GridField. So after...

php,silverstripe
I am uploading an image and while storing the image, I am setting the Filename like 'assets/Uploads/54f092af271b9.png' but after saving, the Filename fields loses some part. It becomes 'assets/54f092af271b9.png' losing the "Uploads/" directory altogether. Is it supposed to happen? Here's the codes: <?php $img = new Image(); $baseName = pathinfo($file,...

silverstripe
Would anyone be able to post a simple example of working with AJAX requests in silverstripe? Couldn't find much documentation on this. Let's say we create a page type 'AjaxPage' and have the controller output a form with a text box to enter your name and a submit button. I'd...

css,tinymce,wysiwyg,silverstripe
Is there any way to prevent certain custom wysiwyg styles to be applied to certain HTML elements? Suppose I have two styles called "red" and "framed". One colours text red and the latter puts a frame around photos. Can I control which styles are available when highlighting text or an...

silverstripe
In SilverStripe 3.1 is it possible to add different tabs and fields on the about page for example. And then different tabs and fields on a services page for example. About Page - Images Tab / Attachments Tab Services Page - Images Tab / Attachments Tab / Staff Person Tab...

sql,silverstripe,datalist
I have this silverstripe query that does not work ( it outputs all messages and not the ones with the date range ) What would be the best way to tackle this query? Im fairly new to silverstripe and havent been able to find information on how to print the...

hash,hyperlink,rewrite,anchor,silverstripe
Ok so I am developing a site in Silverstripe CMS that is using anchor links on one of it's pages. Thing is that in Silverstripe there is a rewrite going on that puts slashes before the hash in your links. So in the docs it explains that you can put...

php,ajax,silverstripe
This is a continuation of an issue I was having earlier where a link needed to be inserted into a SilverStripe GridField for each item. Now the idea is that instead of a link there will be a custom action to initiate the download so there needs to be a...

silverstripe
I am using SilverStripe (version 3.1.6) with advancedworkflow addon. My site is build mostly on data objects. I have assigned both object and model admin in the .yml file as described in the documentation: MyObject: extensions: - WorkflowApplicable MyObjectAdmin: extensions: - AdvancedWorkflowExtension I have also assign the workflow in the...

angularjs,rest,silverstripe
I am using Angular with SilverStripe for my backend. I am using this module https://github.com/silverstripe/silverstripe-restfulserver for my REST API instead of building it myself. When the API returns a list with a many_many relationship it looks like <Recipe href="http://localhost/groceryList/api/v1/Recipe/2.xml"> <Title>Chilli</Title> <ID>2</ID> <Ingredients linktype="many_many" href="http://localhost/groceryList/api/v1/Recipe/2/Ingredients.xml"> <Ingredient...

silverstripe
I have successfully installed subsite module in silverstripe, I just wanted to know that, is it possible to create 2 separate HomePage controller for main site and subsite. I am trying to remove gallery field and tab from subsite home page not from main site home page.

php,report,silverstripe
As an exercise to help me learn about writing custom reports, I've written a very simple custom report to list pages by their page type. I wrote the code based on the standard report cms/code/reports/BrokenLinksReport.php (included as part of the CMS) but am getting an error: [Notice] Object of class...

content-management-system,silverstripe
I am trying to move the default Metadata field in the SilverStripe CMS but I can't seem to do so successfully. This is what I have tried: $fields->removeFieldFromTab("Root.Content.Main", "Metadata"); $fields->insertBefore(new FormField('Metadata', 'Metadata'), 'Content'); But it does not work. I can remove this field but adding it back in where I...

silverstripe
I have this function: public function LatestArticles() { return $this->Children() ->filter('PublicationDate:LessThanOrEqual', SS_Datetime::now()) ->sort('PublicationDate','desc'); } It's not outputting anything at all. If I switch it to this: public function LatestArticles() { return ArticlePage::get() ->filter('PublicationDate:LessThanOrEqual', SS_Datetime::now()) ->sort('PublicationDate','desc'); } It outputs my ArticlePages, but that (obviously) includes all ArticlePages site wide, not just...

silverstripe
I have watched lesson 7 - lesson 10 videos on the silverstripe.org website, have read all the articles on this page: http://docs.silverstripe.org/en/3.1/developer_guides/model/, been all up in the API and have googled silverstripe/stackoverflow forums for hours. I am really stuck trying to apply what I learned though. Here is what I'm...

templates,silverstripe
<%loop $Video.Limit(4) %><% end_loop %> <%loop $Video.Limit(5,9) %><% end_loop %> Two divs are being used to display the data,the above code is not working. Any help is accepted....

php,silverstripe,oembed
I am attempting to implement an oembed provider using the Silverstripe framework but have come across an issue. I have a controller routed from the url /omebed.json and it works fine if I call something like /omebed.json?mediaurl=mymovie.mp4. However the Oembed standard states it should be /omebed.json?url=mymovie.mp4 But Silverstripe internally checks...

comments,blogs,silverstripe
I'm setting up my first ever site in Silverstripe and I'm having trouble with the silverstripe blog module (https://github.com/silverstripe/silverstripe-blog/tree/0.3). I've installed it and the two supporting modules comments (https://github.com/silverstripe/silverstripe-comments) and grid-field-bulk-editing tools and they all seem to have installed without incident. Finally, I've checked the box in the setting for...

select,silverstripe
How can I add a blank value to a Silverstripe DropDownField and require a non-blank value to be selected? Currently, my field is: $myField = new DropdownField( 'MyField', "So what'll it be, yes or no?", array( "N"=>"No", "Y"=>"Yes") ); Am using SilverStripe 3.1...

silverstripe,access-control
How can I restrict view access to a page type in SilverStripe to admin users only? I'd prefer to do it through the code itself, but through the CMS would be good to know too. I think this answer gets me most of the way there; I just need to...

templates,module,controller,rendering,silverstripe
SilverStripe 3.1.x How to Render with a specific template from an Extension? In SilverStripe 3.1.x, How can I make a Page render with a specific template from a Module Extension? I'm working on a module that allows an administrator to change the display behaviour of a page at specific timeframes....

sorting,loops,templates,silverstripe
In my template I'm looping my child pages as 2 separate lists and then their grandchild pages under these. But I want these greatgrandchild pages to be sorted as an entire list and not divided / grouped by their parents. Simply loop after loop does not work as all greatgrandchild...

silverstripe,swipestripe
I've installed Swipestripe module. and added swipestripe-gallery module for product images. when I did dev/bulid?flush=1 it shows error Class 'Gallery_PageExtension' does not exists I have seen gallery.yml file in swipestripe-gallery/_config folder, which has Product: extensions: - 'Gallery_PageExtension' but this class is not there in Product.php file in swipestripe-gallery/code folder. After...

php,silverstripe
I am trying to add a dataobject to the site config (Settings). I have managed to add a logo field and this works now I would like to add some repeater fields eg (social media fields). This doesn't work. I am getting an error. Code and error below. I have...

navigation,silverstripe,template-variables
The below template code from one of the tutorials on the official SilverStripe website ("How to create a navigation menu") includes the template variable $Menu(1) What does the (1) mean? What happens if it gets changed to something else? <ul> <% loop $Menu(1) %> <li> <a href="$Link" title="Go to the...

php,controller,blogs,silverstripe
Silverstripe: I have a blog on my page with muliple pages, and 10 entries per page. I want my controller to know which page of the blog is currently being viewed. I have the following code: public function dependsOnPage() { $page = getPageHere; /*How can I get which page of...

php,forms,silverstripe
I'm very new to Silverstripe, On the CMS page I can add a dropdown form item, and I see that I can create options. BUT. What I want to do is populate the dropdown from an array. How can I do this? The array will look something like this: $dropdownFields...