|
Prismic.io PHP kit
3.0.0
|
Public Member Functions | |
| __construct ($blocks) | |
| getBlocks () | |
| asText () | |
| getFirstPreformatted () | |
| getPreformatted () | |
| getFirstParagraph () | |
| getParagraphs () | |
| getFirstImage () | |
| getImages () | |
| getFirstHeading () | |
| getHeadings () | |
| asHtml ($linkResolver=null, $htmlSerializer=null) | |
Public Member Functions inherited from Prismic\Fragment\FragmentInterface | |
| asHtml ($linkResolver) | |
Static Public Member Functions | |
| static | asHtmlBlock ($block, $linkResolver=null, $htmlSerializer=null) |
| static | insertSpans ($text, array $spans, $linkResolver=null, $htmlSerializer=null) |
| static | parseSpan ($json) |
| static | parseText ($json) |
| static | parseBlock ($json) |
| static | parse ($json) |
| static | extractLink ($data) |
This class embodies a StructuredText fragment.
Technically, a StructuredText fragment is not much more than an array of blocks, but there are many things to do with this fragment, including in the HTML serialization, but not only. It is arguably the most powerful and manipulable way any CMS stores structured text nowadays.
| Prismic\Fragment\StructuredText::__construct | ( | $blocks | ) |
Constructs a StructuredText object.
| array | $blocks | the array of objects |
| Prismic\Fragment\StructuredText::asHtml | ( | $linkResolver = null, |
|
$htmlSerializer = null |
|||
| ) |
Builds a HTML version of the StructuredText fragment.
| \Prismic\LinkResolver | $linkResolver | the link resolver |
| lambda | $htmlSerializer | an optional function to generate custom HTML code |
|
static |
Transforms a block into HTML (for internal use)
| \Prismic\Fragment\Block\BlockInterface | $block | a given block |
| \Prismic\LinkResolver | $linkResolver | the link resolver |
| lambda | $htmlSerializer |
| Prismic\Fragment\StructuredText::asText | ( | ) |
Builds a text version of the StructuredText fragment.
Implements Prismic\Fragment\FragmentInterface.
|
static |
| Prismic\Fragment\StructuredText::getBlocks | ( | ) |
Returns the array of blocks.
| Prismic\Fragment\StructuredText::getFirstHeading | ( | ) |
Returns the first heading block in the StructuredText fragment.
| Prismic\Fragment\StructuredText::getFirstImage | ( | ) |
Returns the first image block in the StructuredText fragment.
| Prismic\Fragment\StructuredText::getFirstParagraph | ( | ) |
Returns the first paragraph block in the StructuredText fragment.
| Prismic\Fragment\StructuredText::getFirstPreformatted | ( | ) |
Returns the first preformatted block in the StructuredText fragment.
| Prismic\Fragment\StructuredText::getHeadings | ( | ) |
Returns an array of all heading blocks in the StructuredText fragment, as objects.
| Prismic\Fragment\StructuredText::getImages | ( | ) |
Returns an array of all image blocks in the StructuredText fragment, as objects.
| Prismic\Fragment\StructuredText::getParagraphs | ( | ) |
Returns an array of all paragraph blocks in the StructuredText fragment, as objects.
| Prismic\Fragment\StructuredText::getPreformatted | ( | ) |
Returns an array of all preformatted blocks in the StructuredText fragment, as objects.
|
static |
Transforms a text block into HTML (for internal use)
| string | $text | the raw text of the block |
| array | $spans | the spans of the block, as an array of objects |
| \Prismic\LinkResolver | $linkResolver | the link resolver |
|
static |
Parses a given StructuredText fragment (for internal use)
| \stdClass | $json | the json bit retrieved from the API that represents a StructuredText fragment. |
|
static |
Parses a given block (for internal use)
| \stdClass | $json | the json bit retrieved from the API that represents a block. |
|
static |
Parses a given span (for internal use)
| \stdClass | $json | the json bit retrieved from the API that represents a span. |
|
static |
Parses a given text block (for internal use)
| \stdClass | $json | the json bit retrieved from the API that represents a text block. |
1.8.12