Humblee

A humble PHP framework & CMS

Block Slots

By default, a template can include each block type once. Block slots remove that limitation — they let you add the same block type to a template multiple times, each instance appearing as a distinct, independently editable content area.

A common use case is a page with two separate rich text sections, or a landing page with three instances of a "feature card" block stacked vertically.


How slots work

When you add a block type to a template, Humblee generates a slot key for that instance. The slot key is what your view uses to reference that specific content area — rather than the block type's generic object key.

  • The first slot of a given block type keeps the block's base object key (e.g. rich_text)
  • Each additional slot gets a numbered suffix (e.g. rich_text_2, rich_text_3, and so on)

Slot keys are assigned automatically and are immutable after first save. Renaming a slot key would break any view or content row that references it. You can update a slot's display label at any time, but the key is fixed.


Adding slots in the CMS

In Admin > Templates, open the template you want to edit and use the blocks section to add your content areas. Each time you add the same block type, a new slot is created for it with a unique key.

Each slot has:

  • Label — the name shown to editors in the page content editor. Make this descriptive enough that an editor knows which part of the page it controls (e.g. Intro Section, Feature Block 1, Footer CTA).
  • Slot key — auto-generated and read-only after first save.
  • Sort order — controls the display order of slots in the editor.

Removing a slot from the template deletes it. Any content rows that were saved for that slot remain in the database but are no longer reachable through the editor or rendered by the view.


Referencing slots in a view

Once slots are defined, reference each one by its slot key in your view file:

<section class="intro">
    <?php Draw::content($content, 'rich_text') ?>
</section>

<section class="features">
    <?php Draw::content($content, 'rich_text_2') ?>
</section>

<section class="closing">
    <?php Draw::content($content, 'rich_text_3') ?>
</section>

Each slot key maps to an independent content row. Editors update them separately in the page content editor, and each has its own revision history.

Tip: the slot key is what Draw::content() uses as its lookup key. If you add a block in the CMS and the view does not reference its slot key, that content area will exist in the editor but will never appear on the page.


Legacy vs. slotted rows

Earlier content rows that were saved before slots were introduced have a template_block_id of 0. The framework still resolves these by object key for backward compatibility. Rows saved through a slot have a non-zero template_block_id and are resolved by slot key instead. You do not need to manage this distinction — Draw::content() handles it transparently based on how the template is configured.