PHP Trait Bolt\Storage\Entity\ContentValuesTrait

This is a breakout of the old Bolt\Content class and serves two main purposes: * Maintain backward compatibility for Bolt\Content through the remainder of the 2.x development/release life-cycle * Attempt to break up former functionality into sections of code that more resembles Single Responsibility Principles These traits should be considered transitional, the functionality in the process of refactor, and not representative of a valid approach.
Author: Gawain Lynch ([email protected])
Show file Open project: bolt/bolt

Protected Properties

Property Type Description
$isRootType Whether this is a "real" contenttype or an embedded ones

Public Methods

Method Description
excerpt ( $length = 200, $includeTitle = false, $focus = null ) Alias for getExcerpt()
get ( string $name ) : mixed Pseudo-magic function, used for when templates use {{ content.get(title) }}, so we can map it to $this->values['title'].
getExcerpt ( integer $length = 200, boolean $includeTitle = false, string | array $focus = null ) : Twig_Markup Create an excerpt for the content.
getImage ( ) : string Get the first image in the content.
getTitle ( $allowBasicTags = false ) : string Get the title, name, caption or subject.
getTitleColumnName ( ) : array Get the columnname of the title, name, caption or subject.
getValues ( boolean $json = false, boolean $stripped = false ) : array Return a content objects values.
hasTemplateFields ( ) : boolean Check if a ContentType field has a template set.
setFromPost ( array $values, string $contenttype ) : void Set a ContentType record values from a HTTP POST.
setValue ( string $key, mixed $value ) Set a ContentType record's individual value.
setValues ( array $values ) Set a ContentType record's values.

Protected Methods

Method Description
getTemplateFieldsContentType ( ) : string Get the template associate with a ContentType field.

Method Details

excerpt() public method

Alias for getExcerpt()
public excerpt ( $length = 200, $includeTitle = false, $focus = null )

get() public method

Pseudo-magic function, used for when templates use {{ content.get(title) }}, so we can map it to $this->values['title'].
public get ( string $name ) : mixed
$name string
return mixed

getExcerpt() public method

Create an excerpt for the content.
public getExcerpt ( integer $length = 200, boolean $includeTitle = false, string | array $focus = null ) : Twig_Markup
$length integer
$includeTitle boolean
$focus string | array
return Twig_Markup

getImage() public method

Get the first image in the content.
public getImage ( ) : string
return string

getTemplateFieldsContentType() protected method

Get the template associate with a ContentType field.
protected getTemplateFieldsContentType ( ) : string
return string

getTitle() public method

Get the title, name, caption or subject.
public getTitle ( $allowBasicTags = false ) : string
return string

getTitleColumnName() public method

Get the columnname of the title, name, caption or subject.
public getTitleColumnName ( ) : array
return array

getValues() public method

Return a content objects values.
public getValues ( boolean $json = false, boolean $stripped = false ) : array
$json boolean Set to TRUE to return JSON encoded values for arrays
$stripped boolean Set to true to strip all of the base fields
return array

hasTemplateFields() public method

Check if a ContentType field has a template set.
public hasTemplateFields ( ) : boolean
return boolean

setFromPost() public method

Set a ContentType record values from a HTTP POST.
public setFromPost ( array $values, string $contenttype ) : void
$values array
$contenttype string
return void

setValue() public method

Set a ContentType record's individual value.
public setValue ( string $key, mixed $value )
$key string
$value mixed

setValues() public method

Set a ContentType record's values.
public setValues ( array $values )
$values array

Property Details

$isRootType protected property

Whether this is a "real" contenttype or an embedded ones
protected $isRootType