SampleBlocks
Corex\Blocks\SampleBlocks · class · Blocks layer
Sample content in shipped patterns (spec 115, US-SAFE-14): a block whose class list holds is-corex-sample is an example someone has to replace, such as invented figures, a quote or a list of partners. A visitor sees nothing of it. Someone who can edit posts sees it with the label “Sample: replace before publishing”, on the site and in the block editor. The editor removes the marker the first time the block’s content is changed (assets/sample-editor.js), and from then on the block is ordinary content. Loaded on every site, so the filter returns at once for a block without the marker. Its stylesheets load only where they are needed: the label’s on a page that draws one, the editor’s in the editor.
Public API
Section titled “Public API”__construct(string $pluginFile, string $version)
Section titled “__construct(string $pluginFile, string $version)”register(): void
Section titled “register(): void”isSample(array $block): bool
Section titled “isSample(array $block): bool”render(string $content, array $block): string
Section titled “render(string $content, array $block): string”enqueueEditorScript(): void
Section titled “enqueueEditorScript(): void”enqueueEditorStyle(): void
Section titled “enqueueEditorStyle(): void”The editor’s canvas is a frame of its own, and enqueue_block_assets is the hook that reaches it. It also runs on the site, where the label’s own stylesheet does the work.