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:
-
contextObject-
[contentSettings]Object optional -
siteString -
onlyThisSiteBoolean -
typeString
-
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:
-
eventString -
dataObject -
cbFunction
_get
-
id -
[options] -
cb
Parameters:
-
idString -
[options]Object optional -
cbFunction
_retrieveOnUpdateAndMerge
-
dto -
options -
cb
Parameters:
-
dtoObject -
optionsObject-
[isCreate]Boolean optional
-
-
cbFunction
add
-
dto -
[options] -
cb
Parameters:
-
dtoObject -
[options]Object optional -
cbFunctionA 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
-
-
cbFunctionA 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:
-
idString -
optionsObject -
cbFunction
deleteSingle
-
[options] -
cb
Parameters:
-
[options]Object optionalSee BaseObjectService#getSingle-
[where]Object optional
-
-
cbFunction
gatherDataForRender
-
contentArray -
cb
Parameters:
-
contentArrayArray -
cbFunction
get
-
id -
options -
cb
Parameters:
-
idString -
optionsObject-
[render=false]Boolean optional -
[readMore=false]Boolean optional
-
-
cbFunction
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
-
-
cbFunction
getAllWithCount
-
[options] -
cb
Parameters:
-
[options]Object optional-
[select]Object optional -
[where]Object optional -
[order]Array optional -
[limit]Integer optional -
[offset]Integer optional
-
-
cbFunctionA 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
-
-
cbFunction
getIdWhere
-
dto
Parameters:
-
dtoObject
Returns:
getMetaInfo
-
content -
cb
Retrieves the SEO metadata for the specified content.
Parameters:
-
contentObjectThe content to retrieve information for
-
cbFunctionA 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
-
-
cbFunction
getRenderer
()
ContentRenderer
Retrieves an instance of a content renderer
Returns:
getRenderOptions
-
options -
isMultiple
Provides the options for rendering
Parameters:
-
optionsObject -
isMultipleBoolean
Returns:
getSingle
-
[options] -
cb
Parameters:
-
[options]Object optional-
[select]Object optional -
[where]Object optional -
[order]Array optional -
[offset]Integer optional -
[readMore=false]Boolean optional
-
-
cbFunction
getTopicsForContent
-
content
Extracts an array of Topic IDs from the content that the content is associated with.
Parameters:
-
contentObject
Returns:
An array of strings representing the Topic IDs
getType
()
String
Returns:
render
-
contentArray -
[options] -
cb
Parameters:
-
contentArrayArray -
[options]Object optionalAn optional argument to provide rendering settings.
-
[readMore]Boolean optionalSpecifies if content body layout should be truncated, and read more links rendered.
-
-
cbFunction
save
-
dto -
[options] -
cb
Parameters:
-
dtoObject -
[options]Object optional-
[isCreate]Boolean optional
-
-
cbFunctionA 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:
-
whereObject
update
-
dto -
[options] -
cb
Parameters:
-
dtoObject -
[options]Object optional -
cbFunctionA 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:
-
contextObject-
dataObject -
validationErrorsArray
-
-
cbFunction(Error)
