├── .gitignore
├── README.md
├── _config.php
├── composer.json
├── css
└── blog.css
├── templates
└── Includes
│ ├── BlogSummary.ss
│ └── BlogSideBar.ss
└── code
├── BlogEntryExtension.php
└── BlogHolderExtension.php
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | silverstripe-blog-extension
2 | ===========================
3 |
4 | SilverStripe Blog Extension, adds features to Blog module
--------------------------------------------------------------------------------
/_config.php:
--------------------------------------------------------------------------------
1 | =5.3.2",
5 | "silverstripe/blog": "*"
6 | }
7 | }
--------------------------------------------------------------------------------
/css/blog.css:
--------------------------------------------------------------------------------
1 | .BlogError {
2 | text-align: center;
3 | }
4 |
5 | .BlogError p {
6 | color: #fff;
7 | display: inline;
8 | background-color: #f77;
9 | padding: 7px;
10 | font-weight:bold;
11 | }
12 |
13 | .edit-post {
14 | clear:both;
15 | padding-top:10px;
16 | }
17 |
18 | .blogEntry {
19 | margin: 10px 0 0;
20 | }
21 |
22 | h4.postTitle {
23 | margin-top: 10px;
24 | }
25 |
26 | .blogSummary {
27 | margin: 0 0 20px;
28 | padding: 0 0 20px;
29 |
30 | border-bottom: solid 1px #444444;
31 | }
32 |
33 | .left {
34 | float: left;
35 | margin: 0 10px 5px 0;
36 | }
37 | .right {
38 | float: right;
39 | margin: 0 0 5px 10px;
40 | }
41 |
--------------------------------------------------------------------------------
/templates/Includes/BlogSummary.ss:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Posted <% if Author %>by $Author.XML <% end_if %><% _t('POSTEDON', 'on') %> $Date.NiceUS
4 |
5 |
6 | <% if BlogHolder.ShowFullEntry %>
7 | $Content
8 | <% else %>
9 |
10 | <% if Image %>
<% end_if %>
11 | $Content.FirstParagraph(text)
12 |
13 | <% end_if %>
14 |
15 |
Read the full post
16 |
17 | <% if TagsCollection %>
18 |
19 | Tags:
20 | <% loop TagsCollection %>
21 | $Tag<% if not Last %>,<% end_if %>
22 | <% end_loop %>
23 |
24 | <% end_if %>
25 |
26 |
27 |
--------------------------------------------------------------------------------
/templates/Includes/BlogSideBar.ss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/code/BlogEntryExtension.php:
--------------------------------------------------------------------------------
1 | 'Boolean'
7 | );
8 |
9 | static $has_one = array(
10 | 'Image' => 'Image',
11 | 'Thumbnail' => 'Image'
12 | );
13 |
14 | public function updateCMSFields(FieldList $fields) {
15 |
16 | // Main Image
17 | $ImageField = new UploadField('Image', 'Main Image');
18 | $ImageField->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
19 | $ImageField->setConfig('allowedMaxFileNumber', 1);
20 | $ImageField->setFolderName('Uploads/BlogEntries');
21 | $fields->addFieldToTab('Root.Images', $ImageField);
22 |
23 | // Thumbnail Image
24 | $ImageField = new UploadField('Thumbnail', 'Thumbnail Preview (square)');
25 | $ImageField->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
26 | $ImageField->setConfig('allowedMaxFileNumber', 1);
27 | $ImageField->setFolderName('Uploads/BlogEntryThumbs');
28 | //$fields->addFieldToTab('Root.Images', $ImageField);
29 |
30 | // featured
31 | $fields->addFieldToTab('Root.Main', new CheckboxField('Featured', 'Featured Post (display link in Featured box in sidebar)'), 'Content');
32 |
33 | }
34 |
35 | public function getArticle() {
36 |
37 | if ($this->owner->ThumbnailID) {
38 | $extra = '