Permalink
Browse files

MINOR: Documentation, tutorial (part3, and tidy-up part 1&2 )

Fixed up Forms documentation, and replaced some images in first 2
tutorials
  • Loading branch information...
1 parent 766b03f commit 2d80ea5939ecf9783dc3e19e12926393fb09ef63 @adrexia adrexia committed with chillu Jul 2, 2012
@@ -135,9 +135,9 @@ To add our new fields to the CMS we have to override the *getCMSFields()* method
public function getCMSFields() {
$fields = parent::getCMSFields();
- $datefield = new DateField('Date');
- $datefield->setConfig('showcalendar', true);
- $fields->addFieldToTab('Root.Main', $datefield, 'Content');
+ $dateField = new DateField('Date');
+ $dateField->setConfig('showcalendar', true);
+ $fields->addFieldToTab('Root.Main', $dateField, 'Content');
$fields->addFieldToTab('Root.Main', new TextField('Author'), 'Content');
return $fields;
@@ -202,18 +202,17 @@ the date field will have the date format defined by your locale.
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', $dateField = new DateField('Date','Article Date (for example: 20/12/2010)'), 'Content');
- $dateField->setConfig('showcalendar', true);
- $dateField->setConfig('dateformat', 'dd/MM/YYYY');
-
- $fields->addFieldToTab('Root.Main', new TextField('Author','Author Name'), 'Content');
-
+ $dateField->setConfig('showcalendar', true);
+ $fields->addFieldToTab('Root.Main', $dateField, 'Content');
+ $fields->addFieldToTab('Root.Main', new TextField('Author'), 'Content');
+
return $fields;
}
Let's walk through these changes.
:::php
- $fields->addFieldToTab('Root.Content', $dateField = new DateField('Date','Article Date (for example: 20/12/2010)'), 'Content');
+ $fields->addFieldToTab('Root.Main', $dateField = new DateField('Date','Article Date (for example: 20/12/2010)'), 'Content');
*$dateField* is declared only to in order to change the configuration of the DateField.
@@ -228,7 +227,7 @@ By enabling *showCalendar* you show a calendar overlay when clicking on the fiel
*dateFormat* allows you to specify how you wish the date to be entered and displayed in the CMS field. See the `[api:DateField]` documentation for more configuration options.
:::php
- $fields->addFieldToTab('Root.Content', new TextField('Author','Author Name'), 'Content');
+ $fields->addFieldToTab('Root.Main', new TextField('Author','Author Name'), 'Content');
By default the field name *'Date'* or *'Author'* is shown as the title, however this might not be that helpful so to change the title, add the new title as the second argument.
@@ -309,7 +308,7 @@ We can make our templates more modular and easier to maintain by separating comm
We'll separate the display of linked articles as we want to reuse this code later on.
-Cut the code in *ArticleHolder.ss** and replace it with an include statement:
+Cut the code between "loop Children" in *ArticleHolder.ss** and replace it with an include statement:
**themes/simple/templates/Layout/ArticleHolder.ss**
@@ -371,7 +370,7 @@ This function simply runs a database query that gets the latest news articles fr
:::ss
...
- <div class="content">$Content</div>
+ <div class="content">$Content</div>
</article>
<% loop LatestNews %>
<% include ArticleTeaser %>
Oops, something went wrong. Retry.

0 comments on commit 2d80ea5

Please sign in to comment.