Skip to content
  1. Extras
  2. PageBuilder
  3. Frontend output
  4. Snippets
  5. PageBuilderResource

PageBuilderResource snippet ​

Outputs sections from another resource. Same PHP as PageBuilder. Set the source with resource_id.

Purpose ​

  • Hero or FAQ from a child page on the home page.
  • Shared block on several resources without duplicating sections in each document.

Where to call ​

Template or chunk. Uncached call.

Parameters ​

ParameterDefaultDescription
resource_id0Source ID. 0 = current resource
section_typesemptySection key filter
return_values0JSON instead of HTML (same as PageBuilder)
use_cache1HTML cache
load_cssfrom settingFrontend CSS
wrap_pagelike load_csspb-page wrapper

If no resource can be resolved, the response is an empty string, including when return_values=1. If the id exists but there is no PageBuilder record, return_values=1 returns { "plainText": "", "sections": [] }.

Snippet properties list only resource_id and section_types. There is no required mark on resource_id. Other parameters work like PageBuilder. A call without arguments does not fail.

Example: FAQ from “About” on the home page ​

modx
[[!PageBuilderResource?
  &resource_id=`15`
  &section_types=`faq`
]]
fenom
{'!PageBuilderResource' | snippet : [
  'resource_id' => 15,
  'section_types' => 'faq'
]}

Permissions and publish state ​

  • The HTML path returns only the published PageBuilder snapshot. The source draft is not visible on the site.
  • The snippet does not check the view policy on the source resource.
  • Limit access on the MODX resource or through Public API, where the view policy is checked.

See also ​