building-blocktypes · git:20260913.db96265 · 2026-09-13 · sha256 ea606dcdc6548f77

building-blocktypes git:20260913.db96265A

Immutable. This exact content is served forever at /api/v1/blob/ea606dcdc6548f77.

---
name: building-blocktypes
description: Create and manage Concrete CMS block types. Use this skill when the user asks to create or modify custom block types.
---

# Building Block Types

Block types are the fundamental units of content in Concrete CMS. They allow users to add different types of content (text, images, forms, etc.) to pages.

## Basic Workflow for Block Type Development

1.  **Define the Block Type Directory**:
    - If in a package: `packages/your_package/blocks/block_handle/`
    - If in application: `application/blocks/block_handle/`
2.  **Create the Controller**:
    - Create `controller.php` in the block directory.
3.  **Create the View**:
    - Create `view.php` for the public output.
4.  **Create Add/Edit Forms**:
    - Create `add.php` and `edit.php` for the dashboard interface.
    - These files typically include `form.php`: `<?php $this->inc('form.php'); ?>`
    - Do not forget these files, as they are required for the block to be added or edited in the CMS.
5.  **Create the Form Template**:
    - Create `form.php` which is shared by both `add.php` and `edit.php`.
6.  **Define Database Schema**:
    - Create `db.xml` (Doctrine XML format) to define the block's data table.
    - Refer to the `working-with-database` skill for the XML format.
7.  **Register the Block Type**:
    - Install via Dashboard or programmatically in a package `install()` method.

## Reference Documentation

- [Form Widgets (Page/File Selector, Combo Box)](references/form_widgets.md)
- [Custom Pagination with Pagerfanta](references/pagination.md)