mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #2953 from jordanmkoncz/patch-1
Fixed inconsistencies and out of date information
This commit is contained in:
commit
7f704cfc97
@ -200,10 +200,12 @@ the date field will have the date format defined by your locale.
|
||||
public function getCMSFields() {
|
||||
$fields = parent::getCMSFields();
|
||||
|
||||
$fields->addFieldToTab('Root.Main', $dateField = new DateField('Date','Article Date (for example: 20/12/2010)'), 'Content');
|
||||
$dateField = new DateField('Date', 'Article Date (for example: 20/12/2010)');
|
||||
$dateField->setConfig('showcalendar', true);
|
||||
$dateField->setConfig('dateformat', 'dd/MM/YYYY');
|
||||
|
||||
$fields->addFieldToTab('Root.Main', $dateField, 'Content');
|
||||
$fields->addFieldToTab('Root.Main', new TextField('Author'), 'Content');
|
||||
$fields->addFieldToTab('Root.Main', new TextField('Author', 'Author Name'), 'Content');
|
||||
|
||||
return $fields;
|
||||
}
|
||||
@ -211,7 +213,7 @@ the date field will have the date format defined by your locale.
|
||||
Let's walk through these changes.
|
||||
|
||||
:::php
|
||||
$fields->addFieldToTab('Root.Main', $dateField = new DateField('Date','Article Date (for example: 20/12/2010)'), 'Content');
|
||||
$dateField = new DateField('Date', 'Article Date (for example: 20/12/2010)');
|
||||
|
||||
*$dateField* is declared in order to change the configuration of the DateField.
|
||||
|
||||
@ -335,19 +337,23 @@ Now let's make a purely cosmetic change that nevertheless helps to make the info
|
||||
Add the following field to the *ArticleHolder* and *ArticlePage* classes:
|
||||
|
||||
:::php
|
||||
private static $icon = "framework/docs/en/tutorials/_images/treeicons/news-file.gif";
|
||||
private static $icon = "cms/images/treeicons/news-file.gif";
|
||||
|
||||
|
||||
And this one to the *HomePage* class:
|
||||
|
||||
:::php
|
||||
private static $icon = "framework/docs/en/tutorials/_images/treeicons/home-file.gif";
|
||||
private static $icon = "cms/images/treeicons/home-file.png";
|
||||
|
||||
|
||||
This will change the icons for the pages in the CMS.
|
||||
|
||||
![](_images/tutorial2_icons2.jpg)
|
||||
|
||||
<div class="hint" markdown="1">
|
||||
Note: The `news-file` icon may not exist in a default SilverStripe install. Try adding your own image, or choosing a different one from the `tree-icons` collection.
|
||||
</div>
|
||||
|
||||
## Showing the latest news on the homepage
|
||||
|
||||
It would be nice to greet page visitors with a summary of the latest news when they visit the homepage. This requires a little more code though - the news articles are not direct children of the homepage, so we can't use the *Children* control. We can get the data for news articles by implementing our own function in *HomePage_Controller*.
|
||||
|
Loading…
Reference in New Issue
Block a user