class DvsPageData

A storage container class that stores collections and fields for a given page. These fields and collections are addeded to a singleton registered in Devise\Pages\PagesServiceProvider.php called 'dvsPageData'. ALl blade views that contain fields and/or collections will use methods like addCollection and addField respectively to add in the data. Eventually all this data is spit out as JSON for the javascript library in devise to take over from there.

Methods

__construct(TagManager $TagManager, CollectionsRepository $CollectionsRepository, PagesRepository $PagesRepository)

Create a new page data object

string
toJSON()

Creates a json object that we use for editing a devise page

void
initialize($pageId, $pageVersionId, $languageId, $csrfToken)

The dvs page data cannot create fields and collection objects without knowing what page we are on. This is injected in on every view that uses dvsPageData.

void
register($id, $bindingType, $collection, $key, $type, $humanName, $collectionName, $group, $category, $alternateTarget)

Register a binding, collection or model data-devise tag using this method.

setDefaults(string $id, mixed $defaults)

Try to set defaults for an id

string
cid($id, $bindingType, $collection, $key, $type, $humanName, $collectionName, $group, $category, $alternateTarget, $defaults)

Returns the cid for this $id and also sets default values for this cid. At this point, the $default values should be set correctly, if not then we need to just throw the exception because something is not right. We also allow for variables in this place, so we need to update all the values for this $id. So if we have a human name with like $someVar in it, then this is the place where we actually update it.

[type]
database([type] $key, [type] $value)

Set the values up in the database

Details

at line 92
__construct(TagManager $TagManager, CollectionsRepository $CollectionsRepository, PagesRepository $PagesRepository)

Create a new page data object

Parameters

TagManager $TagManager
CollectionsRepository $CollectionsRepository
PagesRepository $PagesRepository

at line 107
string toJSON()

Creates a json object that we use for editing a devise page

Return Value

string

at line 142
void initialize($pageId, $pageVersionId, $languageId, $csrfToken)

The dvs page data cannot create fields and collection objects without knowing what page we are on. This is injected in on every view that uses dvsPageData.

..

Parameters

$pageId
$pageVersionId
$languageId
$csrfToken

Return Value

void

at line 166
void register($id, $bindingType, $collection, $key, $type, $humanName, $collectionName, $group, $category, $alternateTarget)

Register a binding, collection or model data-devise tag using this method.

Parameters

$id
$bindingType
$collection
$key
$type
$humanName
$collectionName
$group
$category
$alternateTarget

Return Value

void

at line 203
setDefaults(string $id, mixed $defaults)

Try to set defaults for an id

Parameters

string $id
mixed $defaults

at line 243
string cid($id, $bindingType, $collection, $key, $type, $humanName, $collectionName, $group, $category, $alternateTarget, $defaults)

Returns the cid for this $id and also sets default values for this cid. At this point, the $default values should be set correctly, if not then we need to just throw the exception because something is not right. We also allow for variables in this place, so we need to update all the values for this $id. So if we have a human name with like $someVar in it, then this is the place where we actually update it.

..

if this field's binding type is a creator, field, or colelction then we only use 1 cid

if this type is a model or attribute then we need to register a new cid for this thing... because we are dealing with new instances everytime we get called

(think about iterating over a collection of models inside of a foreach loop), each one has their own key (model's id)

Parameters

$id
$bindingType
$collection
$key
$type
$humanName
$collectionName
$group
$category
$alternateTarget
$defaults

Return Value

string

at line 261
[type] database([type] $key, [type] $value)

Set the values up in the database

Parameters

[type] $key
[type] $value

Return Value

[type]