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
- Define the Block Type Directory:
- If in a package:
packages/your_package/blocks/block_handle/ - If in application:
application/blocks/block_handle/
- If in a package:
- Create the Controller:
- Create
controller.phpin the block directory.
- Create
- Create the View:
- Create
view.phpfor the public output.
- Create
- Create Add/Edit Forms:
- Create
add.phpandedit.phpfor 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.
- Create
- Create the Form Template:
- Create
form.phpwhich is shared by bothadd.phpandedit.php.
- Create
- Define Database Schema:
- Create
db.xml(Doctrine XML format) to define the block's data table. - Refer to the
working-with-databaseskill for the XML format.
- Create
- Register the Block Type:
- Install via Dashboard or programmatically in a package
install()method.
- Install via Dashboard or programmatically in a package
Reference Documentation
- Form Widgets (Page/File Selector, Combo Box)
- Custom Pagination with Pagerfanta