tentapress / custom-blocks
v0.1.1
2026-02-05 15:55 UTC
Requires
- php: ^8.2
- tentapress/blocks: <1.0
- tentapress/system: <1.0
README
Single-file block discovery for active TentaPress themes.
Plugin Details
| Field | Value |
|---|---|
| ID | tentapress/custom-blocks |
| Version | 0.1.1 |
| Provider | TentaPress\\CustomBlocks\\CustomBlocksServiceProvider |
What It Does
- Scans the active theme at
views/blocks/**/*.blade.php - Registers only files that include valid block metadata in a
tp:blockBlade comment - Registers definitions into the
BlockRegistry - Makes discovered blocks available in the existing blocks editor
Block File Format
Create a block file in your active theme, for example:
themes/<vendor>/<theme>/views/blocks/pricing.blade.php
{{-- tp:block { "name": "Pricing", "description": "Tiered pricing cards", "fields": [ { "key": "headline", "label": "Headline", "type": "text" }, { "key": "plans", "label": "Plans JSON", "type": "textarea", "rows": 8 } ], "defaults": { "headline": "Pricing", "plans": [] } } --}} <section> <h2>{{ $props['headline'] ?? '' }}</h2> </section>
Metadata behavior
tp:blockmetadata is required for a file to be registered as a custom block.typeis optional. If omitted, it defaults totentapress/custom-blocks/<file-slug>.viewis optional. If omitted, it defaults toblocks.<relative.path>.nameanddescriptionfallback automatically if omitted.fields,defaults,variants, anddefault_variantfollow the same shape as JSON block definitions.
Field Types (Admin Inputs)
Each field is an object in the fields array with the core keys:
key(string, required): stored underprops[key]label(string, required): shown in the editor UItype(string, required): one of the types below
Optional keys supported on all field types:
help(string): helper text below the inputplaceholder(string): placeholder text for text-like inputs
Supported types
Text
{ "key": "headline", "label": "Headline", "type": "text" }
Textarea
{ "key": "body", "label": "Body", "type": "textarea", "rows": 4 }
Markdown
{ "key": "content", "label": "Content", "type": "markdown", "rows": 10, "height": "240px" }
Rich text
{ "key": "summary", "label": "Summary", "type": "richtext" }
Select
{
"key": "alignment",
"label": "Alignment",
"type": "select",
"options": [
{ "value": "left", "label": "Left" },
{ "value": "center", "label": "Center" }
]
}
Toggle
{ "key": "show_border", "label": "Show border", "type": "toggle", "toggle_label": "Enabled" }
Number
{ "key": "columns", "label": "Columns", "type": "number", "min": 1, "max": 6, "step": 1 }
Range
{ "key": "opacity", "label": "Opacity", "type": "range", "min": 0, "max": 100, "step": 5 }
Color
{ "key": "accent", "label": "Accent Color", "type": "color" }
URL
{ "key": "cta_url", "label": "CTA URL", "type": "url" }
Media
{ "key": "hero_image", "label": "Hero Image", "type": "media" }
Media list
{ "key": "gallery", "label": "Gallery", "type": "media-list" }
Notes
- Any unrecognized
typefalls back to a standard text input. defaultsare applied when fields are missing on a block.variantsanddefault_variantare optional and follow the same structure as core block definitions.
Commands
php artisan tp:plugins sync
php artisan tp:plugins enable tentapress/custom-blocks
php artisan tp:plugins cache