Snippets - Little bits of code to make you happy
-
SnippetsMaking the Tree Tools sticky for easier editing on large sites
22 March 2011 | | | Supports v2.4
Tweet
If you have ever had to edit content on a SilverStripe site with lots of pages, you will have noticed how furstrating it is to have to keep scrolling back up the tree panel to create a page or enable drag and drop re-ordering. Well, here is a handy bit of CSS you can add to keep the tools static, even as you scroll down the tree.
Continue reading... -
SnippetsAdding a Thumbnail to a DataObjectManager
21 May 2009 | | | Supports v2.4, v2.3
Tweet
This snippet lets you add a thumbnail to items in UncleCheese's Data Object Manager module or a regular Complex Table field. All you need to do is create a function that returns a thumbnail and refer to this function in your DOM or CTF definition.
Continue reading... -
SnippetsSpice up Your CMS Sitetree
27 August 2009 | | | Supports v2.4, v2.3
Tweet
So you have created your own page types, but they all look the same in your CMS site tree. Time to make them more recognizable!
This is quite easy, but it can make your site tree a lot more attractive.
Continue reading...
-
SnippetsSilverStripe developer bookmarklets
2 April 2012 | | | Supports v2.4, v2.3
Tweet
Here are some handy dynamic bookmarklets for your browser for one click access to things like rebuilding the database, flushing the cache and accessing the CMS!
Continue reading... -
SnippetsHide pages in Sitetree that a user can't edit
15 September 2009 | | | Supports v2.4, v2.3
Tweet Sometimes you want to hide pages in the Sitetree that members logged into the CMS don't have permission to edit. This is really simple in because they already have a css style applied to them you can just hide that class. You need to include this snippet in your typography.css file so that it is included in the CMS. Continue reading... -
SnippetsCreate and use a Permission code
18 April 2009 | | | Supports v2.4, v2.3
TweetHave you wanted to add an extra permission code that you can add to groups and then use that to test whether a particular user has that permission? Here's how it's done. The permission code it self is added via the Controller class, then you use a permission check anywhere in your site code to check the current user. Like so:
Continue reading... -
SnippetsRemoving an Item From the Main CMS Menu
3 July 2009 | |
TweetIf you want to remove an item from the CMSTopMenu without making it inaccessible you can add this line to your _config.php file:
CMSMenu::remove_menu_item('SecurityAdmin');Continue reading...