Creates new content.
Parameters
- datamodel
- Either B_Datamodel or a string name of data model.
Functions inherited from API_SaveData
set
Details...
Set value or values to save.
Description
void set (
mixed $field[,
string $value
= null
]
)
If you use array to set values, the fields that are set earlier but not in the array will be retained.
Parameters
- field
- Field name or an array containing field names as keys and values as values.
- value(optional, default: null)
- If field name is defined in field, a value is defined in this parameter.
Return Values
No value is returned.
Functions
create
Details...
Creates the content.
Description
bool create (
void
)
This function should be called after all set functions. If this function is not called, the content will not be created.
Return Values
Returns TRUE on success, FALSE on failure.
setParent
Details...
Sets parent for content.
Description
void setParent (
string $datamodel[,
int $id
= null
]
)
If parent is not set, the content will have root as parent by default.
Parameters
- datamodel
If id isn't defined, datamodel should be a path to the content.
If id is defined, datamodel should be name of the data model of the content.
- id(optional, default: null)
- The id of content. Define only if datamodel is set to a data model name.
Return Values
No value is returned.
setPublished
Details...
Sets the publishing state of the content
Description
void setPublished (
int $state
)
If this method is not called, new content defaults to published (B::STATE_PUBLISHED).
Parameters
- state
Possible values for state
- B::STATE_NOTPUBLISHED
- Content is not published.
- B::STATE_HIDEFROMNAVIGATION
- Content is published, but not shown in <b:structure> results.
- B::STATE_PUBLISHED
- Content is published.
Return Values
No value is returned.
setTemplate
Details...
Sets parent for content.
Description
void setTemplate (
mixed $template
)
If template is not set, the content will not have any template set and can not be accessed directly from any url but can still be accessed via <b:get> and B::get().
Parameters
- template
template can be a template id or path to the template (relative to the root of templates folder).
Return Values
No value is returned.