Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cwp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
cwp
cwp
Commits
dc85ba9d
Commit
dc85ba9d
authored
Mar 16, 2017
by
Robbie Averill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FIX Ensure "cwp" module Page CMS fields are added before extension hooks are run
parent
954aebd5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
189 additions
and
213 deletions
+189
-213
code/pagetypes/BaseHomePage.php
code/pagetypes/BaseHomePage.php
+72
-82
code/pagetypes/BasePage.php
code/pagetypes/BasePage.php
+51
-69
code/pagetypes/DatedUpdatePage.php
code/pagetypes/DatedUpdatePage.php
+19
-20
code/pagetypes/EventPage.php
code/pagetypes/EventPage.php
+24
-25
code/pagetypes/FooterHolder.php
code/pagetypes/FooterHolder.php
+8
-9
code/pagetypes/NewsPage.php
code/pagetypes/NewsPage.php
+15
-8
No files found.
code/pagetypes/BaseHomePage.php
View file @
dc85ba9d
...
...
@@ -43,104 +43,94 @@ class BaseHomePage extends Page {
}
public
function
getCMSFields
()
{
$fields
=
parent
::
getCMSFields
();
// Main Content tab
$fields
->
addFieldToTab
(
'Root.Main'
,
TreeDropdownField
::
create
(
'LearnMorePageID'
,
_t
(
'BaseHomePage.LearnMoreLink'
,
'Page to link the "Learn More" button to:'
),
'SiteTree'
),
'Metadata'
);
$gridField
=
GridField
::
create
(
'Quicklinks'
,
'Quicklinks'
,
$this
->
Quicklinks
(),
GridFieldConfig_RelationEditor
::
create
()
);
$gridConfig
=
$gridField
->
getConfig
();
$gridConfig
->
getComponentByType
(
'GridFieldAddNewButton'
)
->
setButtonName
(
_t
(
'BaseHomePage.AddNewButton'
,
'Add new'
)
);
$gridConfig
->
removeComponentsByType
(
'GridFieldAddExistingAutocompleter'
);
$gridConfig
->
removeComponentsByType
(
'GridFieldDeleteAction'
);
$gridConfig
->
addComponent
(
new
GridFieldDeleteAction
());
$gridConfig
->
addComponent
(
new
GridFieldSortableRows
(
'SortOrder'
));
$gridField
->
setModelClass
(
'Quicklink'
);
$fields
->
addFieldToTab
(
'Root.Quicklinks'
,
$gridField
);
$fields
->
removeByName
(
'Import'
);
$fields
->
addFieldToTab
(
'Root.Features'
,
ToggleCompositeField
::
create
(
'FeatureOne'
,
_t
(
'SiteTree.FeatureOne'
,
'Feature One'
),
$this
->
beforeUpdateCMSFields
(
function
(
FieldList
$fields
)
{
// Main Content tab
$fields
->
addFieldToTab
(
'Root.Main'
,
TreeDropdownField
::
create
(
'LearnMorePageID'
,
_t
(
'BaseHomePage.LearnMoreLink'
,
'Page to link the "Learn More" button to:'
),
'SiteTree'
),
'Metadata'
);
$gridField
=
GridField
::
create
(
'Quicklinks'
,
'Quicklinks'
,
$this
->
Quicklinks
(),
GridFieldConfig_RelationEditor
::
create
()
);
$gridConfig
=
$gridField
->
getConfig
();
$gridConfig
->
getComponentByType
(
'GridFieldAddNewButton'
)
->
setButtonName
(
_t
(
'BaseHomePage.AddNewButton'
,
'Add new'
)
);
$gridConfig
->
removeComponentsByType
(
'GridFieldAddExistingAutocompleter'
);
$gridConfig
->
removeComponentsByType
(
'GridFieldDeleteAction'
);
$gridConfig
->
addComponent
(
new
GridFieldDeleteAction
());
$gridConfig
->
addComponent
(
new
GridFieldSortableRows
(
'SortOrder'
));
$gridField
->
setModelClass
(
'Quicklink'
);
$fields
->
addFieldToTab
(
'Root.Quicklinks'
,
$gridField
);
$fields
->
removeByName
(
'Import'
);
$fields
->
addFieldToTab
(
'Root.Features'
,
ToggleCompositeField
::
create
(
'FeatureOne'
,
_t
(
'SiteTree.FeatureOne'
,
'Feature One'
),
array
(
TextField
::
create
(
'FeatureOneTitle'
,
_t
(
'BaseHomePage.Title'
,
'Title'
)),
$dropdownField
=
DropdownField
::
create
(
'FeatureOneCategory'
,
_t
(
'BaseHomePage.FeatureCategoryDropdown'
,
'Category icon'
),
singleton
(
'BaseHomePage'
)
->
dbObject
(
'FeatureOneCategory'
)
->
enumValues
()
),
HTMLEditorField
::
create
(
'FeatureOneContent'
,
_t
(
'BaseHomePage.FeatureContentFieldLabel'
,
'Content'
)
),
TextField
::
create
(
'FeatureOneButtonText'
,
_t
(
'BaseHomePage.FeatureButtonText'
,
'Button text'
)
),
TreeDropdownField
::
create
(
'FeatureOneLinkID'
,
_t
(
'BaseHomePage.FeatureLink'
,
'Page to link to'
),
'SiteTree'
)
->
setDescription
(
_t
(
'BaseHomePage.ButtonTextRequired'
,
'Button text must be filled in'
))
)
)
->
setHeadingLevel
(
3
)
);
$dropdownField
->
setEmptyString
(
'none'
);
$fields
->
addFieldToTab
(
'Root.Features'
,
ToggleCompositeField
::
create
(
'FeatureTwo'
,
_t
(
'SiteTree.FeatureTwo'
,
'Feature Two'
),
array
(
TextField
::
create
(
'Feature
One
Title'
,
_t
(
'BaseHomePage.Title'
,
'Title'
)),
TextField
::
create
(
'Feature
Two
Title'
,
_t
(
'BaseHomePage.Title'
,
'Title'
)),
$dropdownField
=
DropdownField
::
create
(
'Feature
One
Category'
,
'Feature
Two
Category'
,
_t
(
'BaseHomePage.FeatureCategoryDropdown'
,
'Category icon'
),
singleton
(
'BaseHomePage'
)
->
dbObject
(
'Feature
One
Category'
)
->
enumValues
()
singleton
(
'BaseHomePage'
)
->
dbObject
(
'Feature
Two
Category'
)
->
enumValues
()
),
HTMLEditorField
::
create
(
'Feature
One
Content'
,
'Feature
Two
Content'
,
_t
(
'BaseHomePage.FeatureContentFieldLabel'
,
'Content'
)
),
TextField
::
create
(
'Feature
One
ButtonText'
,
'Feature
Two
ButtonText'
,
_t
(
'BaseHomePage.FeatureButtonText'
,
'Button text'
)
),
TreeDropdownField
::
create
(
'Feature
One
LinkID'
,
'Feature
Two
LinkID'
,
_t
(
'BaseHomePage.FeatureLink'
,
'Page to link to'
),
'SiteTree'
)
->
setDescription
(
_t
(
'BaseHomePage.ButtonTextRequired'
,
'Button text must be filled in'
))
)
)
->
setHeadingLevel
(
3
)
);
// Icon field will be removed in CWP 2.0
if
(
!
$this
->
getIsDefaultTheme
())
{
$fields
->
removeByName
(
$dropdownField
->
getName
());
}
$dropdownField
->
setEmptyString
(
'none'
);
$fields
->
addFieldToTab
(
'Root.Features'
,
ToggleCompositeField
::
create
(
'FeatureTwo'
,
_t
(
'SiteTree.FeatureTwo'
,
'Feature Two'
),
array
(
TextField
::
create
(
'FeatureTwoTitle'
,
_t
(
'BaseHomePage.Title'
,
'Title'
)),
$dropdownField
=
DropdownField
::
create
(
'FeatureTwoCategory'
,
_t
(
'BaseHomePage.FeatureCategoryDropdown'
,
'Category icon'
),
singleton
(
'BaseHomePage'
)
->
dbObject
(
'FeatureTwoCategory'
)
->
enumValues
()
),
HTMLEditorField
::
create
(
'FeatureTwoContent'
,
_t
(
'BaseHomePage.FeatureContentFieldLabel'
,
'Content'
)
),
TextField
::
create
(
'FeatureTwoButtonText'
,
_t
(
'BaseHomePage.FeatureButtonText'
,
'Button text'
)
),
TreeDropdownField
::
create
(
'FeatureTwoLinkID'
,
_t
(
'BaseHomePage.FeatureLink'
,
'Page to link to'
),
'SiteTree'
)
->
setDescription
(
_t
(
'BaseHomePage.ButtonTextRequired'
,
'Button text must be filled in'
))
)
)
->
setHeadingLevel
(
3
)
);
// Icon field will be removed in CWP 2.0
if
(
!
$this
->
getIsDefaultTheme
())
{
$fields
->
removeByName
(
$dropdownField
->
getName
());
}
$dropdownField
->
setEmptyString
(
'none'
);
)
->
setHeadingLevel
(
3
)
);
$dropdownField
->
setEmptyString
(
'none'
);
});
return
$fields
;
return
parent
::
getCMSFields
()
;
}
}
...
...
code/pagetypes/BasePage.php
View file @
dc85ba9d
...
...
@@ -13,7 +13,7 @@ class BasePage extends SiteTree {
private
static
$hide_ancestor
=
'BasePage'
;
private
static
$pdf_export
=
false
;
/*
*Domain to generate PDF's from, DOES not include protocol
*i.e. google.com not http://google.com
...
...
@@ -135,62 +135,61 @@ class BasePage extends SiteTree {
}
public
function
getCMSFields
()
{
$fields
=
parent
::
getCMSFields
();
// Related Pages
$components
=
GridFieldConfig_RelationEditor
::
create
();
$components
->
removeComponentsByType
(
'GridFieldAddNewButton'
);
$components
->
removeComponentsByType
(
'GridFieldEditButton'
);
$components
->
removeComponentsByType
(
'GridFieldFilterHeader'
);
$components
->
addComponent
(
new
GridFieldSortableRows
(
'SortOrder'
));
$dataColumns
=
$components
->
getComponentByType
(
'GridFieldDataColumns'
);
$dataColumns
->
setDisplayFields
(
array
(
'Title'
=>
_t
(
'BasePage.ColumnTitle'
,
'Title'
),
'ClassName'
=>
_t
(
'BasePage.ColumnPageType'
,
'Page Type'
)
));
$fields
->
findOrMakeTab
(
'Root.RelatedPages'
,
_t
(
'BasePage.RelatedPages'
,
'Related pages'
)
);
$fields
->
addFieldToTab
(
'Root.RelatedPages'
,
GridField
::
create
(
'RelatedPages'
,
_t
(
'BasePage.RelatedPages'
,
'Related pages'
),
$this
->
RelatedPages
(),
$components
)
);
// Taxonomies - Unless they have their own 'Tags' field (such as in Blog, etc)
if
(
!
$this
->
has_many
(
'Tags'
)
&&
!
$this
->
many_many
(
'Tags'
))
{
$this
->
beforeUpdateCMSFields
(
function
(
FieldList
$fields
)
{
// Related Pages
$components
=
GridFieldConfig_RelationEditor
::
create
();
$components
->
removeComponentsByType
(
'GridFieldAddNewButton'
);
$components
->
removeComponentsByType
(
'GridFieldEditButton'
);
$autoCompleter
=
$components
->
getComponentByType
(
'GridFieldAddExistingAutocompleter'
);
$autoCompleter
->
setResultsFormat
(
'$Name ($TaxonomyName)'
);
$components
->
removeComponentsByType
(
'GridFieldFilterHeader'
);
$components
->
addComponent
(
new
GridFieldSortableRows
(
'SortOrder'
));
$dataColumns
=
$components
->
getComponentByType
(
'GridFieldDataColumns'
);
$dataColumns
->
setDisplayFields
(
array
(
'
Name'
=>
_t
(
'BasePage.Term'
,
'Term
'
),
'
TaxonomyName'
=>
_t
(
'BasePage.Taxonomy'
,
'Taxonomy
'
)
'
Title'
=>
_t
(
'BasePage.ColumnTitle'
,
'Title
'
),
'
ClassName'
=>
_t
(
'BasePage.ColumnPageType'
,
'Page Type
'
)
));
$fields
->
findOrMakeTab
(
'Root.Tags'
,
_t
(
'BasePage.TagsTabTitle'
,
'Tags'
));
$fields
->
findOrMakeTab
(
'Root.RelatedPages'
,
_t
(
'BasePage.RelatedPages'
,
'Related pages'
)
);
$fields
->
addFieldToTab
(
'Root.Tags'
,
TreeMultiselectField
::
create
(
'Terms'
,
_t
(
'BasePage.Terms'
,
'Terms'
),
'TaxonomyTerm'
)
->
setDescription
(
_t
(
'BasePage.TermsDescription'
,
'Click to search for additional terms'
))
'Root.RelatedPages'
,
GridField
::
create
(
'RelatedPages'
,
_t
(
'BasePage.RelatedPages'
,
'Related pages'
),
$this
->
RelatedPages
(),
$components
)
);
}
return
$fields
;
// Taxonomies - Unless they have their own 'Tags' field (such as in Blog, etc)
if
(
!
$this
->
has_many
(
'Tags'
)
&&
!
$this
->
many_many
(
'Tags'
))
{
$components
=
GridFieldConfig_RelationEditor
::
create
();
$components
->
removeComponentsByType
(
'GridFieldAddNewButton'
);
$components
->
removeComponentsByType
(
'GridFieldEditButton'
);
$autoCompleter
=
$components
->
getComponentByType
(
'GridFieldAddExistingAutocompleter'
);
$autoCompleter
->
setResultsFormat
(
'$Name ($TaxonomyName)'
);
$dataColumns
=
$components
->
getComponentByType
(
'GridFieldDataColumns'
);
$dataColumns
->
setDisplayFields
(
array
(
'Name'
=>
_t
(
'BasePage.Term'
,
'Term'
),
'TaxonomyName'
=>
_t
(
'BasePage.Taxonomy'
,
'Taxonomy'
)
));
$fields
->
findOrMakeTab
(
'Root.Tags'
,
_t
(
'BasePage.TagsTabTitle'
,
'Tags'
));
$fields
->
addFieldToTab
(
'Root.Tags'
,
TreeMultiselectField
::
create
(
'Terms'
,
_t
(
'BasePage.Terms'
,
'Terms'
),
'TaxonomyTerm'
)
->
setDescription
(
_t
(
'BasePage.TermsDescription'
,
'Click to search for additional terms'
))
);
}
});
return
parent
::
getCMSFields
();
}
/**
...
...
@@ -267,23 +266,6 @@ class BasePage extends SiteTree {
return
$nativeName
;
}
/**
* Decide whether the current configured theme is the "default" CWP theme
*
* @return bool
*/
public
function
getIsDefaultTheme
()
{
if
(
class_exists
(
'SiteConfig'
)
&&
(
$config
=
SiteConfig
::
current_site_config
())
&&
$config
->
Theme
)
{
$theme
=
$config
->
Theme
;
}
elseif
(
Config
::
inst
()
->
get
(
'SSViewer'
,
'theme_enabled'
)
&&
Config
::
inst
()
->
get
(
'SSViewer'
,
'theme'
))
{
$theme
=
Config
::
inst
()
->
get
(
'SSViewer'
,
'theme'
);
}
else
{
$theme
=
false
;
}
return
$theme
===
'default'
;
}
}
class
BasePage_Controller
extends
ContentController
{
...
...
@@ -301,7 +283,7 @@ class BasePage_Controller extends ContentController {
public
static
$results_per_page
=
10
;
public
static
$search_index_class
=
'SolrSearchIndex'
;
/**
* If spelling suggestions for searches are given, enable
* suggested searches to be followed immediately
...
...
@@ -400,7 +382,7 @@ class BasePage_Controller extends ContentController {
// make sure the work directory exists
if
(
!
file_exists
(
dirname
(
$pdfFile
)))
Filesystem
::
makeFolder
(
dirname
(
$pdfFile
));
//decide the domain to use in generation
$pdf_base_url
=
$this
->
getPDFBaseURL
();
...
...
@@ -496,7 +478,7 @@ class BasePage_Controller extends ContentController {
$suggestions
=
isset
(
$data
[
'suggestions'
])
?
$data
[
'suggestions'
]
:
$this
->
config
()
->
search_follow_suggestions
;
$results
=
CwpSearchEngine
::
create
()
->
search
(
$keywords
,
...
...
@@ -524,15 +506,15 @@ class BasePage_Controller extends ContentController {
->
customise
(
$results
)
->
customise
(
array
(
'Results'
=>
$results
->
getResults
()
));
}
// Render
$templates
=
$this
->
getResultsTemplate
(
$request
);
return
$response
->
renderWith
(
$templates
);
}
/**
* Select the template to render search results with
*
*
* @param SS_HTTPRequest $request
* @return array
*/
...
...
code/pagetypes/DatedUpdatePage.php
View file @
dc85ba9d
...
...
@@ -37,27 +37,26 @@ class DatedUpdatePage extends Page {
}
public
function
getCMSFields
()
{
$fields
=
parent
::
getCMSFields
();
$this
->
beforeUpdateCMSFields
(
function
(
FieldList
$fields
)
{
$fields
->
addFieldToTab
(
'Root.Main'
,
$dateTimeField
=
DatetimeField
::
create
(
'Date'
,
$this
->
fieldLabel
(
'Date'
)),
'Content'
);
$dateTimeField
->
getDateField
()
->
setConfig
(
'showcalendar'
,
true
);
$fields
->
addFieldToTab
(
'Root.Main'
,
$dateTimeField
=
DatetimeField
::
create
(
'Date'
,
$this
->
fieldLabel
(
'Date'
)),
'Content'
);
$dateTimeField
->
getDateField
()
->
setConfig
(
'showcalendar'
,
true
);
$fields
->
addfieldToTab
(
'Root.Main'
,
$abstractField
=
TextareaField
::
create
(
'Abstract'
,
$this
->
fieldLabel
(
'Abstract'
)),
'Content'
);
$abstractField
->
setAttribute
(
'maxlength'
,
'160'
);
$abstractField
->
setRightTitle
(
_t
(
'DateUpdatePage.AbstractDesc'
,
'The abstract is used as a summary on the listing pages. It is limited to 160 characters.'
)
);
$abstractField
->
setRows
(
6
);
return
$fields
;
$fields
->
addfieldToTab
(
'Root.Main'
,
$abstractField
=
TextareaField
::
create
(
'Abstract'
,
$this
->
fieldLabel
(
'Abstract'
)),
'Content'
);
$abstractField
->
setAttribute
(
'maxlength'
,
'160'
);
$abstractField
->
setRightTitle
(
_t
(
'DateUpdatePage.AbstractDesc'
,
'The abstract is used as a summary on the listing pages. It is limited to 160 characters.'
)
);
$abstractField
->
setRows
(
6
);
});
return
parent
::
getCMSFields
();
}
}
...
...
code/pagetypes/EventPage.php
View file @
dc85ba9d
...
...
@@ -51,31 +51,30 @@ class EventPage extends DatedUpdatePage {
}
public
function
getCMSFields
()
{
$fields
=
parent
::
getCMSFields
();
$fields
->
removeByName
(
'Date'
);
$dateTimeFields
=
array
();
$dateTimeFields
[]
=
$dateField
=
DateField
::
create
(
'Date'
,
'Date'
);
$dateField
->
setConfig
(
'showcalendar'
,
true
);
$dateField
->
setConfig
(
'dateformat'
,
Member
::
currentUser
()
->
getDateFormat
());
$dateTimeFields
[]
=
$startTimeField
=
TimeField
::
create
(
'StartTime'
,
' '
.
$this
->
fieldLabel
(
'StartTime'
));
$dateTimeFields
[]
=
$endTimeField
=
TimeField
::
create
(
'EndTime'
,
$this
->
fieldLabel
(
'EndTime'
));
// Would like to do this, but the width of the form field doesn't scale based on the time
// format. OS ticket raised: http://open.silverstripe.org/ticket/8260
//$startTimeField->setConfig('timeformat', Member::currentUser()->getTimeFormat());
//$endTimeField->setConfig('timeformat', Member::currentUser()->getTimeFormat());
$startTimeField
->
setConfig
(
'timeformat'
,
'h:ma'
);
$endTimeField
->
setConfig
(
'timeformat'
,
'h:ma'
);
$fields
->
addfieldToTab
(
'Root.Main'
,
$dateTimeField
=
new
FieldGroup
(
'Date and time'
,
$dateTimeFields
),
'Abstract'
);
$fields
->
addfieldToTab
(
'Root.Main'
,
$locationField
=
TextareaField
::
create
(
'Location'
,
$this
->
fieldLabel
(
'Location'
)),
'Abstract'
);
$locationField
->
setRows
(
4
);
return
$fields
;
$this
->
beforeUpdateCMSFields
(
function
(
FieldList
$fields
)
{
$fields
->
removeByName
(
'Date'
);
$dateTimeFields
=
array
();
$dateTimeFields
[]
=
$dateField
=
DateField
::
create
(
'Date'
,
'Date'
);
$dateField
->
setConfig
(
'showcalendar'
,
true
);
$dateField
->
setConfig
(
'dateformat'
,
Member
::
currentUser
()
->
getDateFormat
());
$dateTimeFields
[]
=
$startTimeField
=
TimeField
::
create
(
'StartTime'
,
' '
.
$this
->
fieldLabel
(
'StartTime'
));
$dateTimeFields
[]
=
$endTimeField
=
TimeField
::
create
(
'EndTime'
,
$this
->
fieldLabel
(
'EndTime'
));
// Would like to do this, but the width of the form field doesn't scale based on the time
// format. OS ticket raised: http://open.silverstripe.org/ticket/8260
//$startTimeField->setConfig('timeformat', Member::currentUser()->getTimeFormat());
//$endTimeField->setConfig('timeformat', Member::currentUser()->getTimeFormat());
$startTimeField
->
setConfig
(
'timeformat'
,
'h:ma'
);
$endTimeField
->
setConfig
(
'timeformat'
,
'h:ma'
);
$fields
->
addfieldToTab
(
'Root.Main'
,
$dateTimeField
=
new
FieldGroup
(
'Date and time'
,
$dateTimeFields
),
'Abstract'
);
$fields
->
addfieldToTab
(
'Root.Main'
,
$locationField
=
TextareaField
::
create
(
'Location'
,
$this
->
fieldLabel
(
'Location'
)),
'Abstract'
);
$locationField
->
setRows
(
4
);
});
return
parent
::
getCMSFields
();
}
public
function
NiceLocation
()
{
...
...
code/pagetypes/FooterHolder.php
View file @
dc85ba9d
...
...
@@ -19,14 +19,13 @@ class FooterHolder extends RedirectorPage {
);
public
function
getCMSFields
()
{
$fields
=
parent
::
getCMSFields
();
$fields
->
removeByName
(
'RedirectorDescHeader'
);
$fields
->
removeByName
(
'RedirectionType'
);
$fields
->
removeByName
(
'LinkToID'
);
$fields
->
removeByName
(
'ExternalURL'
);
return
$fields
;
$this
->
beforeUpdateCMSFields
(
function
(
FieldList
$fields
)
{
$fields
->
removeByName
(
'RedirectorDescHeader'
);
$fields
->
removeByName
(
'RedirectionType'
);
$fields
->
removeByName
(
'LinkToID'
);
$fields
->
removeByName
(
'ExternalURL'
);
});
return
parent
::
getCMSFields
();
}
/**
...
...
@@ -48,7 +47,7 @@ class FooterHolder extends RedirectorPage {
}
}
}
public
function
syncLinkTracking
()
{
// If we don't have anything to link to, then we have a broken link.
if
(
!
$this
->
Children
())
{
...
...
code/pagetypes/NewsPage.php
View file @
dc85ba9d
...
...
@@ -33,16 +33,23 @@ class NewsPage extends DatedUpdatePage {
}
public
function
getCMSFields
()
{
$fields
=
parent
::
getCMSFields
();
$fields
->
addFieldToTab
(
'Root.Main'
,
TextField
::
create
(
'Author'
,
$this
->
fieldLabel
(
'Author'
)),
'Abstract'
);
$fields
->
addFieldToTab
(
'Root.Main'
,
UploadField
::
create
(
'FeaturedImage'
,
$this
->
fieldLabel
(
'FeaturedImageID'
)),
'Abstract'
);
return
$fields
;
$this
->
beforeUpdateCMSFields
(
function
(
FieldList
$fields
)
{
$fields
->
addFieldToTab
(
'Root.Main'
,
TextField
::
create
(
'Author'
,
$this
->
fieldLabel
(
'Author'
)),
'Abstract'
);
$fields
->
addFieldToTab
(
'Root.Main'
,
UploadField
::
create
(
'FeaturedImage'
,
$this
->
fieldLabel
(
'FeaturedImageID'
)),
'Abstract'
);
});
return
parent
::
getCMSFields
();
}
}
class
NewsPage_Controller
extends
DatedUpdatePage_Controller
{
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment