ContentObjectService Class
Provides functions to interact with content such as articles and pages. It abstracts the heavy lifting away from specific implementations. This prototype must be extended.
Constructor
ContentObjectService
-
context
Parameters:
-
context
Object-
[contentSettings]
Object optional -
site
String -
onlyThisSite
Boolean -
type
String
-
Item Index
Methods
- _emit
- _get
- _retrieveOnUpdateAndMerge
- add
- count
- deleteById
- deleteSingle
- gatherDataForRender
- get
- getAll
- getAllWithCount
- getContext
- getDrafts
- getIdWhere
- getMetaInfo
- getPublished
- getRenderer
- getRenderOptions
- getSingle
- getTopicsForContent
- getType
- render
- save
- setPublishedClause static
- update
- validateHeadline
Properties
- AFTER_RENDER static
- BEFORE_RENDER static
- contentSettings
- dao
- site
- topicService
- type
Methods
_emit
-
event
-
data
-
cb
Parameters:
-
event
String -
data
Object -
cb
Function
_get
-
id
-
[options]
-
cb
Parameters:
-
id
String -
[options]
Object optional -
cb
Function
_retrieveOnUpdateAndMerge
-
dto
-
options
-
cb
Parameters:
-
dto
Object -
options
Object-
[isCreate]
Boolean optional
-
-
cb
Function
add
-
dto
-
[options]
-
cb
Parameters:
-
dto
Object -
[options]
Object optional -
cb
FunctionA callback that takes two parameters. The first is an error, if occurred. The second is the object that matches the specified query
count
-
[options]
-
cb
Parameters:
-
[options]
Object optional-
[where]
Object optional
-
-
cb
FunctionA callback that takes two parameters. The first is an error, if occurred. The second is the number of results that match the specified query
deleteById
-
id
-
options
-
cb
Parameters:
-
id
String -
options
Object -
cb
Function
deleteSingle
-
[options]
-
cb
Parameters:
-
[options]
Object optionalSee BaseObjectService#getSingle-
[where]
Object optional
-
-
cb
Function
gatherDataForRender
-
contentArray
-
cb
Parameters:
-
contentArray
Array -
cb
Function
get
-
id
-
options
-
cb
Parameters:
-
id
String -
options
Object-
[render=false]
Boolean optional -
[readMore=false]
Boolean optional
-
-
cb
Function
getAll
-
[options]
-
cb
Parameters:
-
[options]
Object optional-
[where]
Object optional -
[select]
Object optional -
[order]
Array optional -
[limit]
Integer optional -
[offset]
Integer optional -
[render=false]
Boolean optional -
[readMore=true]
Boolean optional
-
-
cb
Function
getAllWithCount
-
[options]
-
cb
Parameters:
-
[options]
Object optional-
[select]
Object optional -
[where]
Object optional -
[order]
Array optional -
[limit]
Integer optional -
[offset]
Integer optional
-
-
cb
FunctionA callback that takes two parameters. The first is an error, if occurred. The second is an object representing the results of the query.
getContext
-
[data]
Parameters:
-
[data]
String | Object | Number | Boolean optional
Returns:
getDrafts
-
[options]
-
cb
Parameters:
-
[options]
Object optional-
[where]
Object optional -
[select]
Object optional -
[order]
Array optional -
[limit]
Integer optional -
[offset]
Integer optional -
[render=false]
Boolean optional
-
-
cb
Function
getIdWhere
-
dto
Parameters:
-
dto
Object
Returns:
getMetaInfo
-
content
-
cb
Retrieves the SEO metadata for the specified content.
Parameters:
-
content
ObjectThe content to retrieve information for
-
cb
FunctionA callback that takes two parameters. The first is an Error, if occurred. The second is an object that contains 4 properties: title - the SEO title, description - the SEO description, keywords - an array of SEO keywords that describe the content, thumbnail - a URI path to the thumbnail image
getPublished
-
[options]
-
cb
Parameters:
-
[options]
Object optional-
[where]
Object optional -
[select]
Object optional -
[order]
Array optional -
[limit]
Integer optional -
[offset]
Integer optional -
[render]
Boolean optional
-
-
cb
Function
getRenderer
()
ContentRenderer
Retrieves an instance of a content renderer
Returns:
getRenderOptions
-
options
-
isMultiple
Provides the options for rendering
Parameters:
-
options
Object -
isMultiple
Boolean
Returns:
getSingle
-
[options]
-
cb
Parameters:
-
[options]
Object optional-
[select]
Object optional -
[where]
Object optional -
[order]
Array optional -
[offset]
Integer optional -
[readMore=false]
Boolean optional
-
-
cb
Function
getTopicsForContent
-
content
Extracts an array of Topic IDs from the content that the content is associated with.
Parameters:
-
content
Object
Returns:
An array of strings representing the Topic IDs
getType
()
String
Returns:
render
-
contentArray
-
[options]
-
cb
Parameters:
-
contentArray
Array -
[options]
Object optionalAn optional argument to provide rendering settings.
-
[readMore]
Boolean optionalSpecifies if content body layout should be truncated, and read more links rendered.
-
-
cb
Function
save
-
dto
-
[options]
-
cb
Parameters:
-
dto
Object -
[options]
Object optional-
[isCreate]
Boolean optional
-
-
cb
FunctionA callback that takes two parameters. The first is an error, if occurred. The second is the object that matches the specified query
setPublishedClause
-
where
Parameters:
-
where
Object
update
-
dto
-
[options]
-
cb
Parameters:
-
dto
Object -
[options]
Object optional -
cb
FunctionA callback that takes two parameters. The first is an error, if occurred. The second is the object that matches the specified query
validateHeadline
-
context
-
cb
Validates that a headline is provided and is unique
Parameters:
-
context
Object-
data
Object -
validationErrors
Array
-
-
cb
Function(Error)