PHP 클래스 Devise\Pages\Interpreter\DvsPageData

파일 보기 프로젝트 열기: devisephp/cms

보호된 프로퍼티들

프로퍼티 타입 설명
$CollectionsRepository CollectionRepository The collections repository gets a list of collections for us
$PagesRepository Devise\Pages\PagesRepository The pages repository fetches additional information we need for our page
$TagManager 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

공개 메소드들

메소드 설명
__construct ( TagManager $TagManager, CollectionsRepository $CollectionsRepository, PagesRepository $PagesRepository ) 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

보호된 메소드들

메소드 설명
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

메소드 상세

__construct() 공개 메소드

Create a new page data object
public __construct ( TagManager $TagManager, CollectionsRepository $CollectionsRepository, PagesRepository $PagesRepository )
$TagManager TagManager
$CollectionsRepository Devise\Pages\Collections\CollectionsRepository
$PagesRepository Devise\Pages\PagesRepository

addCollectionNodesIntoGroupsOrNodes() 보호된 메소드

Adds collections into the existing nodes or groups array
protected addCollectionNodesIntoGroupsOrNodes ( array $collections, array $groups, array $nodes )
$collections array
$groups array
$nodes array

addGroupNodes() 보호된 메소드

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
protected addGroupNodes ( array $groups, array $nodes )
$groups array
$nodes array

addNodesIntoGroupsOrNodes() 보호된 메소드

Adds nodes into the existing nodes or groups array
protected addNodesIntoGroupsOrNodes ( array $nodes, array $groups, $allNodes ) : array
$nodes array
$groups array
리턴 array

appendToArray() 보호된 메소드

Helper method so that I don't have to put this logic inside of another foreach loop
protected appendToArray ( array $container, string $key, mixed $item ) : array
$container array
$key string
$item mixed
리턴 array

assertNoDuplicateTags() 보호된 메소드

Makes sure we don't get duplicate tags registered
protected assertNoDuplicateTags ( string $id ) : void
$id string
리턴 void

assertTagExists() 보호된 메소드

.. this means we should have registered the id already
protected assertTagExists ( string $id ) : void
$id string
리턴 void

buildCollectionNode() 보호된 메소드

Collection nodes are grouped together
protected buildCollectionNode ( string $collectionName, array $collectionFields ) : array
$collectionName string
$collectionFields array
리턴 array

buildGroupNode() 보호된 메소드

Group nodes are just a bunch of node items
protected buildGroupNode ( string $cid, $name, $categories ) : array
$cid string
리턴 array

buildNode() 보호된 메소드

Build a node
protected buildNode ( array $node ) : array
$node array
리턴 array

buildNodes() 보호된 메소드

.. Loop through all collections, fields, models, attributes and creators and create the node structure for them.
protected buildNodes ( $collections, $fields, $models, $attributes, $creators ) : array
리턴 array

cid() 공개 메소드

.. 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)
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
리턴 string

database() 공개 메소드

Set the values up in the database
public database ( [type] $key, [type] $value ) : [type]
$key [type]
$value [type]
리턴 [type]

extractModelFromKey() 보호된 메소드

Analyze this key variable and determine if it is a attribute or model type
protected extractModelFromKey ( $chain ) : string
리턴 string

filterTags() 보호된 메소드

Filter the tags by the binding type
protected filterTags ( string $bindingType ) : array
$bindingType string
리턴 array

initialize() 공개 메소드

..
public initialize ( integer $pageId, integer $pageVersionId, integer $languageId, $csrfToken ) : void
$pageId integer
$pageVersionId integer
$languageId integer
리턴 void

jsonEncode() 보호된 메소드

Encodes the object passed in as a json string and also escapes all ' characters
protected jsonEncode ( mixed $object ) : string
$object mixed
리턴 string

register() 공개 메소드

Register a binding, collection or model data-devise tag using this method.
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
리턴 void

resolveTag() 보호된 메소드

Resolve the tag
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
리턴 string

resolveVariableTag() 보호된 메소드

Resolve the variable tag
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
리턴 string

setDefaults() 공개 메소드

Try to set defaults for an id
public setDefaults ( string $id, mixed $defaults )
$id string
$defaults mixed

toJSON() 공개 메소드

Creates a json object that we use for editing a devise page
public toJSON ( ) : string
리턴 string

프로퍼티 상세

$CollectionsRepository 보호되어 있는 프로퍼티

The collections repository gets a list of collections for us
protected CollectionRepository $CollectionsRepository
리턴 CollectionRepository

$PagesRepository 보호되어 있는 프로퍼티

The pages repository fetches additional information we need for our page
protected PagesRepository,Devise\Pages $PagesRepository
리턴 Devise\Pages\PagesRepository

$TagManager 보호되어 있는 프로퍼티

Tag manager that creates and finds fields for our tags
protected TagManager,Devise\Pages\Interpreter $TagManager
리턴 TagManager

$cids 보호되어 있는 프로퍼티

Keeps track of some cids for variable tags
protected array $cids
리턴 array

$csrfToken 보호되어 있는 프로퍼티

Csrf token
protected string $csrfToken
리턴 string

$database 보호되어 있는 프로퍼티

Keeps track of a database that we can build in javascript where all the cool data is stored
protected array $database
리턴 array

$initialized 보호되어 있는 프로퍼티

We don't need to initialize our dvspagedata object more than once
protected bool $initialized
리턴 boolean

$languageId 보호되어 있는 프로퍼티

Language id
protected int $languageId
리턴 integer

$pageId 보호되어 있는 프로퍼티

Page id
protected int $pageId
리턴 integer

$pageVersionId 보호되어 있는 프로퍼티

Page version id
protected int $pageVersionId
리턴 integer

$tags 보호되어 있는 프로퍼티

Keep track of all the page tags
protected array $tags
리턴 array