Update Architecture and structure of the page components (blocks)
parent
dc4c2a7aa2
commit
50c7e50fcb
@ -99,3 +99,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 you want to make another component like it (or other components that retrieve other data).
|
||||||
|
|
||||||
|
### BlockWrapper
|
||||||
|
|
||||||
|
This vue component is responsible for rendering all the component blocks on the pagebuilder canvas and it's options drawer if the user click the associated cogwheel for that component. It's important that you import and include the component in `const components` for it to be detected and rendered.
|
Loading…
Reference in New Issue
Block a user