Update Architecture and structure of the page components (blocks)
parent
e4396a9899
commit
13990cd931
@ -98,7 +98,7 @@ block.js (in `resources/js/Utils`) contains all the component block categories,
|
|||||||
|
|
||||||
This is a somewhat exceptional field that deserves its own section to describe properly. While all the field names so far is encapsulated and operates just within their respective components, the needs field is a special field. It lets the component *"hook"* into the overall lifecycle of the app to retrieve data. It is an optional field and takes an array of strings. Those strings (in this case, one string *'articles'* represents the name(s) of the static function(s) that is going to be called from `App/Helpers/PageBlocksHelper`. Any data returned from that/those function(s) (typically via Eloquent) is included in the `blockData` object.
|
This is a somewhat exceptional field that deserves its own section to describe properly. While all the field names so far is encapsulated and operates just within their respective components, the needs field is a special field. It lets the component *"hook"* into the overall lifecycle of the app to retrieve data. It is an optional field and takes an array of strings. Those strings (in this case, one string *'articles'* represents the name(s) of the static function(s) that is going to be called from `App/Helpers/PageBlocksHelper`. Any data returned from that/those function(s) (typically via Eloquent) is included in the `blockData` object.
|
||||||
|
|
||||||
In the case of this object *'articles'* function, it fetches the appropriate amount of newsarticles to display in the block. The code specifically for these helper functions have been omitted, since it's part of the larger CMS codebase and it's not needed for the pagebuilder to run on it's own. But you can still use the helper functions to retrieve this data, if you want to make another component like it (or other components that retrieve other data).
|
In the case of this object *'articles'* function, it fetches the appropriate amount of newsarticles to display in the block. The code specifically for these helper functions have been omitted, since it's part of the larger CMS codebase and it's not needed for the pagebuilder to run on it's own. But you can still use the helper functions to retrieve this data if your component is ported into the CMS and if you want to make another component like it (or other components that retrieve other data).
|
||||||
|
|
||||||
### BlockWrapper
|
### BlockWrapper
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user