$page→getFormatted()
Get the formatted value of a field, regardless of output formatting state
When a page's output formatting state is on, $page->get('property') or $page->property will
produce the same result as this method call.
Note that for fields where the value contains Page objects, such as Repeater and RepeaterMatrix, those pages are themselves the value, so they are left with output formatting on after this call. This also applies to subsequent access of the field, as the same Page objects are returned. If you need them unformatted afterwards then set that on the pages themselves:
Examples
// Get the formatted 'body' field (text formatters applied)
$body = $page->getFormatted('body');foreach($page->getFormatted('my_repeater') as $item) {
// ...
}
foreach($page->my_repeater as $item) {
$item->of(false); // needed before modifying and saving these items
}Usage
$mixed = $page->getFormatted(string $key);Arguments
| Name | Type(s) | Description |
|---|---|---|
$key | string | Field or property name to retrieve |
Return value
mixed
See Also
API reference based on ProcessWire core version 3.0.275