GCBGutenberg
Control Blocks
v1.3.3
Buy

Path

A line across or down the page with stops along it, each a box your client fills. The line draws as you scroll.

A line across or down the page, with stops along it. Your client bends the line by dragging its nodes in the editor, and fills each stop with any blocks. On the page the line draws itself as the visitor scrolls and each stop appears as the line reaches it. The stops can also be filled from posts.

Recorded in the editor: bend the line, then type / in a stop. Only the blocks you allow are offered.

Download example A zip of block folders for your theme. Needs GCB 1.3.1 or later, and nothing else.

What's in the download

  • path/ The path: the line and its nodes, how long it holds on screen, and the option to fill the stops from posts.
  • layout-box/ One stop. Any blocks inside.

Each folder is an ordinary GCB block: block.json, block.fields.json and render.php, plus a style.css and a view.js where it needs them. There is no build step and no library.

How it's built

The line is one field of the path type: the editor draws it as a line with nodes your client drags, and stores the points. The stops are child blocks, marked with a <Repeater> that names the block a stop is and how many there can be.

path/render.php
<Repeater  allowedBlocks='["gcb/layout-box"]'  addButtonLabel="Add node"  min="1"  max="60"  editLayout="grid"/>

Its fields, from block.fields.json:

FieldType
The line and its nodespath
How long it holdsrange
Fill from poststoggle
Which postsquery-loop

view.js is about 8 KB of plain JavaScript. With no script, the whole line and every stop show.

Use it

  1. Unzip the download.
  2. Copy path/ and layout-box/ into your theme's blocks/ folder.
  3. Reload the block editor. The block is in the inserter.

That's all of it. You don't register the block: there's no register_block_type() call and nothing to add to functions.php. GCB registers every folder in your theme's blocks/ folder by itself.

It is your block now. Change the markup, the fields or the script to suit the design. The docs cover every field type and marker used here.

More examples: all examples, or download them together as the GCB Kit.

Build anything in the block editor

Every licence includes all features and a year of updates and support.

Buy GCB from $8.25 a month See pricing