|
Prismic.io PHP kit
3.0.0
|
Public Member Functions | |
| __construct ($array) | |
| asHtml ($linkResolver=null) | |
| asText () | |
| getArray () | |
Static Public Member Functions | |
| static | parseSubfragmentList ($json) |
| static | parse ($json) |
This class embodies a Group fragment. To understand better how it works: each group contains several sets of subfragments (as many as the content writer saw fit). So, once you have your group, you have two layers to go through: getting the set of subfragments you need (or, most often, looping through all of them); then picking which subfragment from its name, as defined in the JSON mask for this fragment.
For instance: for($groupFragment->getArray() as $groupDoc) { echo $groupDoc.getText('subfragmentName'); }
Each group doc can be manipulated like a regular Document.
| Prismic\Fragment\Group::__construct | ( | $array | ) |
Constructs a group fragment.
| string | $array | the array of associative arrays of subfragments |
| Prismic\Fragment\Group::asHtml | ( | $linkResolver = null | ) |
Builds a HTML version of the Group fragment.
| \Prismic\LinkResolver | $linkResolver | the link resolver |
Implements Prismic\Fragment\FragmentInterface.
| Prismic\Fragment\Group::asText | ( | ) |
Builds a text version of the Group fragment.
Implements Prismic\Fragment\FragmentInterface.
| Prismic\Fragment\Group::getArray | ( | ) |
Returns an array version of this group fragment, on which you can do all you can do on an array: loop, access a certain index, ...
Each item is an associative array of subfragments.
|
static |
|
static |
Parses a list of subfragments, and makes it into an associative array of fragments. Not meant to be used except for testing.
| \stdClass | $json | the json bit retrieved from the API that represents the list of subfragments |
1.8.12