Property | Type | Description | |
---|---|---|---|
$CollectionsRepository | CollectionRepository | The collections repository gets a list of collections for us | |
$PagesRepository | The pages repository fetches additional information we need for our page | ||
$TagManager | Tag manager that creates and finds fields for our tags | ||
$cids | array | Keeps track of some cids for variable tags | |
$csrfToken | string | Csrf token | |
$database | array | Keeps track of a database that we can build in javascript where all the cool data is stored | |
$initialized | boolean | We don't need to initialize our dvspagedata object more than once | |
$languageId | integer | Language id | |
$pageId | integer | Page id | |
$pageVersionId | integer | Page version id | |
$tags | array | Keep track of all the page tags |
Method | Description | |
---|---|---|
__construct ( |
Create a new page data object | |
cid ( string $id, string $bindingType, string $collection, string $key, string $type, string $humanName, $collectionName, string $group, string $category, string $alternateTarget, mixed $defaults ) : string | 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. | |
database ( [type] $key, [type] $value ) : [type] | Set the values up in the database | |
initialize ( integer $pageId, integer $pageVersionId, integer $languageId, $csrfToken ) : void | 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. | |
register ( string $id, string $bindingType, string $collection, string $key, string $type, string $humanName, $collectionName, string $group, string $category, string $alternateTarget ) : void | Register a binding, collection or model data-devise tag using this method. | |
setDefaults ( string $id, mixed $defaults ) | Try to set defaults for an id | |
toJSON ( ) : string | Creates a json object that we use for editing a devise page |
Method | Description | |
---|---|---|
addCollectionNodesIntoGroupsOrNodes ( array $collections, array $groups, array $nodes ) | Adds collections into the existing nodes or groups array | |
addGroupNodes ( array $groups, array $nodes ) | Adds the groups into the nodes. Groups are organized into categories. Some groups only have 1 category but it is possible to have many categories inside of a single group | |
addNodesIntoGroupsOrNodes ( array $nodes, array $groups, $allNodes ) : array | Adds nodes into the existing nodes or groups array | |
appendToArray ( array $container, string $key, mixed $item ) : array | Helper method so that I don't have to put this logic inside of another foreach loop | |
assertNoDuplicateTags ( string $id ) : void | Makes sure we don't get duplicate tags registered | |
assertTagExists ( string $id ) : void | Assert that the id exists. | |
buildCollectionNode ( string $collectionName, array $collectionFields ) : array | Collection nodes are grouped together | |
buildGroupNode ( string $cid, $name, $categories ) : array | Group nodes are just a bunch of node items | |
buildNode ( array $node ) : array | Build a node | |
buildNodes ( $collections, $fields, $models, $attributes, $creators ) : array | Build the node structure for this json. This takes into account groups too. Nodes that are grouped together we will take that into account too. | |
extractModelFromKey ( $chain ) : string | Analyze this key variable and determine if it is a attribute or model type | |
filterTags ( string $bindingType ) : array | Filter the tags by the binding type | |
jsonEncode ( mixed $object ) : string | Encodes the object passed in as a json string and also escapes all ' characters | |
resolveTag ( string $id, string $bindingType, string $collection, string $key, string $type, string $humanName, $collectionName, string $group, string $category, string $alternateTarget, mixed $defaults ) : string | Resolve the tag | |
resolveVariableTag ( string $id, string $bindingType, string $collection, string $key, string $type, string $humanName, $collectionName, string $group, string $category, string $alternateTarget, mixed $defaults ) : string | Resolve the variable tag |
public __construct ( |
||
$TagManager | ||
$CollectionsRepository | ||
$PagesRepository |
protected addGroupNodes ( array $groups, array $nodes ) | ||
$groups | array | |
$nodes | array |
protected assertNoDuplicateTags ( string $id ) : void | ||
$id | string | |
return | void |
protected assertTagExists ( string $id ) : void | ||
$id | string | |
return | void |
protected buildGroupNode ( string $cid, $name, $categories ) : array | ||
$cid | string | |
return | array |
protected buildNodes ( $collections, $fields, $models, $attributes, $creators ) : array | ||
return | array |
public cid ( string $id, string $bindingType, string $collection, string $key, string $type, string $humanName, $collectionName, string $group, string $category, string $alternateTarget, mixed $defaults ) : string | ||
$id | string | |
$bindingType | string | |
$collection | string | |
$key | string | |
$type | string | |
$humanName | string | |
$group | string | |
$category | string | |
$alternateTarget | string | |
$defaults | mixed | |
return | string |
public database ( [type] $key, [type] $value ) : [type] | ||
$key | [type] | |
$value | [type] | |
return | [type] |
protected extractModelFromKey ( $chain ) : string | ||
return | string |
protected filterTags ( string $bindingType ) : array | ||
$bindingType | string | |
return | array |
protected jsonEncode ( mixed $object ) : string | ||
$object | mixed | |
return | string |
public register ( string $id, string $bindingType, string $collection, string $key, string $type, string $humanName, $collectionName, string $group, string $category, string $alternateTarget ) : void | ||
$id | string | |
$bindingType | string | |
$collection | string | |
$key | string | |
$type | string | |
$humanName | string | |
$group | string | |
$category | string | |
$alternateTarget | string | |
return | void |
protected resolveTag ( string $id, string $bindingType, string $collection, string $key, string $type, string $humanName, $collectionName, string $group, string $category, string $alternateTarget, mixed $defaults ) : string | ||
$id | string | |
$bindingType | string | |
$collection | string | |
$key | string | |
$type | string | |
$humanName | string | |
$group | string | |
$category | string | |
$alternateTarget | string | |
$defaults | mixed | |
return | string |
protected resolveVariableTag ( string $id, string $bindingType, string $collection, string $key, string $type, string $humanName, $collectionName, string $group, string $category, string $alternateTarget, mixed $defaults ) : string | ||
$id | string | |
$bindingType | string | |
$collection | string | |
$key | string | |
$type | string | |
$humanName | string | |
$group | string | |
$category | string | |
$alternateTarget | string | |
$defaults | mixed | |
return | string |
public setDefaults ( string $id, mixed $defaults ) | ||
$id | string | |
$defaults | mixed |
protected CollectionRepository $CollectionsRepository | ||
return | CollectionRepository |
protected PagesRepository,Devise\Pages $PagesRepository | ||
return |
protected TagManager,Devise\Pages\Interpreter $TagManager | ||
return |
protected array $cids | ||
return | array |
protected array $database | ||
return | array |
protected bool $initialized | ||
return | boolean |