Download the PHP package pedalcms/cassette-cmf without Composer
On this page you can find all versions of the php package pedalcms/cassette-cmf. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pedalcms/cassette-cmf
More information about pedalcms/cassette-cmf
Files in pedalcms/cassette-cmf
Package cassette-cmf
Short Description WP Content Modeling Framework
License GPL-2.0-or-later
Informations about the package cassette-cmf
Cassette-CMF (WordPress Content Modeling Framework)
A powerful, flexible Composer library for building WordPress plugins with custom post types, taxonomies, settings pages, and dynamic form fields.
Features
- Custom Post Types - Register CPTs with fields using array or JSON configuration
- Custom Taxonomies - Create taxonomies with custom term meta fields
- Settings Pages - Top-level and submenu pages with automatic form handling
- 18 Field Types - Text, textarea, number, email, url, password, date, color, select, checkbox, radio, wysiwyg, upload, custom_html, tabs, metabox, group, repeater
- Conditional Fields - Show and hide fields with declarative
conditionalrules - Container Fields - Organize fields with tabs, metaboxes, groups, and repeaters
- Extend Existing - Add fields to existing post types, taxonomies, and settings pages
- Array Configuration - Register everything from a single PHP array
- JSON Configuration - Load configurations from JSON files with schema validation
- Before-Save Filters - Modify or validate field values before saving
- Validation & Sanitization - Built-in security with customizable rules
- Asset Management - Context-aware CSS/JS enqueuing
- i18n Ready - Full internationalization support
Requirements
- PHP: 8.2 or higher
- WordPress: 6.0 or higher
- Composer: For autoloading
Installation
Quick Start
Basic Example
Extending Existing Post Types and Taxonomies
JSON Configuration
Conditional Fields
Conditional visibility works in both PHP arrays and JSON configs. Hidden fields keep their submitted value, but they skip validation while their condition is false.
Supported operators: ==, !=, >, >=, <, <=, in, not_in, empty, not_empty. Use relation: "OR" when a field should appear if any rule matches. Conditional fields are supported for regular fields and container contents such as groups, tabs, and metaboxes, but not for repeater sub-fields.
Field Types
Basic Fields
| Type | Description | Key Options |
|---|---|---|
text |
Single-line text input | placeholder, maxlength, pattern |
textarea |
Multi-line text input | rows, cols, maxlength |
number |
Numeric input | min, max, step |
email |
Email input | Automatic validation |
url |
URL input | Automatic validation |
password |
Password input | Masked input |
date |
Date picker | min, max |
color |
Color picker | WordPress color picker |
Choice Fields
| Type | Description | Key Options |
|---|---|---|
select |
Dropdown select | options, multiple |
checkbox |
Checkbox input | options (for multiple) |
radio |
Radio button group | options |
Rich Content
| Type | Description | Key Options |
|---|---|---|
wysiwyg |
Visual editor | TinyMCE with media buttons |
upload |
Media uploader | button_text, library_type, preview |
custom_html |
Display custom HTML | content, allowed_tags, raw_html |
Container Fields
| Type | Description | Key Options |
|---|---|---|
tabs |
Tabbed container | orientation, tabs[] |
metabox |
Metabox container | context, priority, fields[] |
group |
Field group | label, description, fields[] |
repeater |
Repeatable fields | button_label, min, max, fields[] |
Retrieving Values
Cassette-CMF provides a universal static method to retrieve field values regardless of their storage location:
Method Signature
| Parameter | Type | Description |
|---|---|---|
$field_name |
string | The field name as defined in your config |
$context |
int|string | Post ID, term ID, or settings page ID |
$context_type |
string | 'post' (default), 'term', or 'settings' |
$default |
mixed | Default value if field is empty |
Context-Specific Helper Methods
Legacy Approach (Still Works)
Before-Save Filters
Modify or validate field values before saving:
Examples
| Example | Description |
|---|---|
| 01-simple-array | Book CPT + Genre Taxonomy + Library Settings (PHP) |
| 02-simple-json | Event CPT + Event Taxonomies + Settings (JSON) |
| 03-advanced-array | Full demo: CPTs, taxonomies, settings, containers, filters |
| 04-advanced-json | Full demo with multi-file JSON configuration |
Documentation
- Field API Documentation
- Examples
Testing
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Write tests for your changes
- Ensure all tests pass (
composer test) - Submit a pull request
License
GPL-2.0-or-later. See LICENSE for details.
Support
- GitHub Issues
- Documentation
- Examples