PHP Interface Yosymfony\Spress\Core\DataSource\ItemInterface

Author: Victor Puertas ([email protected])
Show file Open project: spress/spress Interface Usage Examples

Public Methods

Method Description
getAttributes ( ) : array The item’s attributes.
getCollection ( ) : string Gets the collection of the item. e.g: "pages" or "posts".
getContent ( $snapshotName = '' ) : string Get the compiled content. A snapshot is the compiled content at a specific point during the compilation process. "last" snapshot is the most recent compiled content. Binary content cannot have snapshots.
getId ( ) : string A string that uniquely identifies an item.
getPath ( $snapshotName = '' ) : string The item's relative path. e.g: "index.html" or "my-page/index.html".
getRelationshipCollection ( ) : Yosymfony\Spress\Core\DataSource\RelationshipCollection Gets the RelationshipCollection instance associated with this item.
getType ( ) : string Return the type of this item. Values: "item", "layout" or "include".
isBinary ( ) : boolean True if the item is binary; false if it is not.
setAttributes ( array $values ) Set the attributes of this item.
setCollection ( string $name ) Sets the collection of the item.
setContent ( $content, $snapshotName ) Set the compiled content.
setPath ( string $value, $snapshotName ) Set the item's relative path.

Method Details

getAttributes() public method

The item’s attributes.
public getAttributes ( ) : array
return array

getCollection() public method

"pages" is the defatul collection.
public getCollection ( ) : string
return string The name of the collection

getContent() public method

Snaptshots: - raw: the uncompiled content of this item (not available for binary items). - last: the most recent compiled content. - after_convert: the compiled content after converter has been applied. - after_render: the compiled content after renderizer has been applied.
public getContent ( $snapshotName = '' ) : string
$snapshotName The name of the snapshot. "last" by default
return string The content or empty-string If the snapshot does not exist

getId() public method

A string that uniquely identifies an item.
public getId ( ) : string
return string

getPath() public method

An Item without path will not be stored. Snaptshots: - last: the most recent path. - relative: relative path. - absolute: absolute path. Useful for binary content. - permalink: a relative path generated by permalink generator component.
public getPath ( $snapshotName = '' ) : string
$snapshotName The name of the snapshot. "last" by default
return string The path or empty-string If the snapshot does not exist

getRelationshipCollection() public method

Gets the RelationshipCollection instance associated with this item.
public getRelationshipCollection ( ) : Yosymfony\Spress\Core\DataSource\RelationshipCollection
return Yosymfony\Spress\Core\DataSource\RelationshipCollection A RelationshipCollection instance

getType() public method

Return the type of this item. Values: "item", "layout" or "include".
public getType ( ) : string
return string

isBinary() public method

True if the item is binary; false if it is not.
public isBinary ( ) : boolean
return boolean

setAttributes() public method

Set the attributes of this item.
public setAttributes ( array $values )
$values array

setCollection() public method

Sets the collection of the item.
public setCollection ( string $name )
$name string The name of the collection

setContent() public method

Set the compiled content.
public setContent ( $content, $snapshotName )
$content Mixed The compiled content
$snapshotName The name of the snapshot. The snapshot "last" is not valid

setPath() public method

Set the item's relative path.
public setPath ( string $value, $snapshotName )
$value string e.g: "index.html" or "my-page/index.html"
$snapshotName The name of the snapshot. The snapshot "last" is not valid