๐งฉ Architecture & Core Logic
- Super Powers
- Joomla Powers
- Compile Native Components, Plugins & Modules
- Multi-Version Support
- Conditional Logic Injection
- Reusable Admin Views
- Dynamic GET Builder
- Round-Trip Code Integration
- Custom Admin Views
- Site Views
- Dynamic Dashboards
- Model Linking Between Views
- Shared Field Reuse Across Views
- Drag & Drop Field Mapping
- Dynamic Field Visibility
- Independent Packaging
๐ Joomla CMS Integration
๐งฑ Custom Code System (Powerful Dual Feature)
๐ Field Type System
๐ Snippets, Templates, Layouts, Libraries
- Snippets Reusable Html Blocks
- Layouts Reusable Php Render Templates
- Templates Page Level Views Linked To Custom Admin Site Views
- Libraries JS CSS Assets Linked To UI
- CDN Local Toggle For Library Delivery
- Media Folder Injection With Override Support
- Repository Push Pull Reset Workflow
- Init Snippets Layouts Templates Via Gui
๐ฆ Packages
๐งฉ Architecture & Core Logic
๐ File & Code Management
๐ง Code Reuse & Blueprints
๐ Joomla CMS Integration
๐จ Visual GUI & UX
๐ Internationalization
๐ฆ Packaging & Distribution
โ๏ธ Compiler Engine Features
๐งฑ Custom Code System
๐ Field Type System
๐ Dynamic GET (Visual SQL Engine)
๐ Snippets, Templates, Layouts, Libraries
๐ Documentation & Metadata
๐ Analytics & Insights
๐งฉ Architecture & Core Logic
- Super Powers
- Joomla Powers
- Compile Native Components, Plugins & Modules
- Multi-Version Support
- Conditional Logic Injection
- Reusable Admin Views
- Dynamic GET Builder
- Round-Trip Code Integration
- Custom Admin Views
- Site Views
- Dynamic Dashboards
- Model Linking Between Views
- Shared Field Reuse Across Views
- Drag & Drop Field Mapping
- Dynamic Field Visibility
- Independent Packaging
๐ Joomla CMS Integration
- Token Integration
- ACL Per View, Field, Item
- Field-Based Joomla Config Generation
- Support For Joomla Categories/Tags/Custom Fields
- CLI-Ready Components
- Joomla Update Server Integration
- Version-Aware Language String Compilation
- Remote Publishing to Custom Repo Update Streams
๐ Field Type System
- Field Types Define Templates And Data Types
- Gui Defined Rules Required Unique Nullable
- Save Get Hooks Per Field
- Database Schema Auto Generated From Field Settings
- Per Display Field Rendering Config List Edit
- Create Dynamic Models With Modals Selectors
- Conditional Js And Css Per Field
๐ Snippets, Templates, Layouts, Libraries
- Snippets Reusable Html Blocks
- Layouts Reusable Php Render Templates
- Templates Page Level Views Linked To Custom Admin Site Views
- Libraries JS CSS Assets Linked To UI
- CDN Local Toggle For Library Delivery
- Media Folder Injection With Override Support
- Repository Push Pull Reset Workflow
- Init Snippets Layouts Templates Via Gui
Universal Reusable Code Blocks
developer's shortcut to writing efficient, consistent, and maintainable Joomla extensions
What Are Reusable Code Blocks?
Reusable Code Blocks (called โCustom Codeโ in JCB) are named, context-aware entities that contain PHP or HTML code. Instead of writing the same logic in multiple templates or controller files, you can:
- Create a code block once via the JCB GUI.
- Reference it anywhere in your project using its unique key.
- Have it injected dynamically at compile time, respecting placeholders and environment.
Key Features
- ๐ Named Reference Keys: Each reusable block is uniquely identified by a key (e.g., custom.user.validation), making it easy to reference.
- ๐ Inject Anywhere: You can inject these code blocks into views, models, templates, controllers, or even inside other custom code blocks.
- ๐ง Dynamic Placeholder Support: Insert context-specific variables like {item.id}, {user.id}, {table}, {view} etc., which get replaced during compilation.
- ๐ฆ PHP or HTML Compatible: Define business logic, HTML output, or mixed content. Both front-end and back-end environments are supported.
- ๐๏ธโ๐จ๏ธ Visual Diff & Update Detection: JCB compares injected versions to originals and warns you if something has been manually changed, preserving the round-trip editing experience.
- ๐ Round-Trip Friendly: Changes injected into compiled files are preserved across rebuilds using insert/replace tags, making the system robust for iterative development.
Use Cases
- Shared validation logic across views
- Render repeated HTML elements like toolbars or status badges
- Common AJAX handlers or controller functions
- Role-checking logic injected into multiple places
- Layout segments like footers, titles, or custom buttons
How to Use
- Go to Custom Code in JCB
- Create a new code block and assign it a unique key
- Define your logic (PHP or HTML)
- Reference this key in any view/template using the injection system
- Compile and view it auto-injected where expected
Smart Features
- Code blocks can be versioned and stored like other entities
- Detected during diff comparisons for override safety
- Support nesting (a custom code block can call another)
Why It Matters
- โ DRY Principle (Donโt Repeat Yourself): Write once, use anywhere. Greatly improves maintainability and avoids code duplication.
- โ Faster Prototyping: Once a block is defined, it can instantly be reused in other components or views.
- โ Cleaner Views and Templates: Avoid clutter by abstracting reusable logic out of the view and into structured code blocks.
Conclusion
Custom Code Entities in JCB are a developerโs shortcut to writing efficient, consistent, and maintainable Joomla extensions. They enable a modular development style while ensuring every piece of logic is reusable and traceable. Whether you're building complex workflows or simply want to DRY up your markup โ universal reusable code blocks are an essential part of modern JCB development.
Summary
Reusable code blocks in Joomla Component Builder (JCB) allow you to define snippets of PHP or HTML once and inject them dynamically into multiple parts of your component. These code entities โ known in JCB as Custom Code โ are universal and logic-aware. They reduce duplication, improve maintainability, and ensure consistency across admin views, site views, templates, and more.