Skip to main content

Shared Field Types

Define once. Reuse everywhere. Maintain consistent logic and structure across components

What Are Shared Field Types?

Shared Field Types in JCB are reusable, blueprint-defined Joomla field structures that can be used across multiple views, components, or even projects. They function as templates for field definitions โ€” allowing you to standardize configuration, display, validation, database mapping, and custom scripting.

Instead of redefining the same field multiple times (e.g. a date picker, publish toggle, user selector), you create it once as a Shared Field Type and then reuse it wherever needed. If you later update the shared definition, all linked fields across the project can inherit or reference the changes.

Key Features

  • ๐Ÿ“Ž Define Once, Reuse Everywhere: Create standardized field templates (e.g. status toggle, image uploader, currency field) and insert them into multiple views/components.
  • ๐Ÿง  Blueprint-Level Configuration: Shared field types include:
    • Type (text, calendar, list, textarea, etc.)
    • Validation (required, unique, nullable)
    • Tooltips, labels, descriptions
    • DB constraints (length, default values)
    • Access control per field
    • Dynamic options via custom scripting
  • ๐Ÿ” Automatically Syncable: Linked fields can inherit updates from the shared type, making maintenance easier across large projects.
  • ๐Ÿ”€ Clone or Inherit: Choose whether to create a static copy or maintain a live reference to the shared type.
  • ๐Ÿ” Secure and Filterable: Enforce safe HTML, proper date formatting, and ACL logic consistently across reused fields.
  • ๐Ÿงช Perfect for Prototypes and Boilerplates: Quickly scaffold views using battle-tested field patterns.

Use Cases

  • ๐Ÿ—“ Standard โ€œPublished From / Toโ€ fields across multiple components
  • ๐Ÿ‘ค User picker field with ACL
  • ๐Ÿท๏ธ Tag input with dynamic source
  • ๐Ÿ’ฐ Currency field with precision settings
  • ๐Ÿ“ Multiline textarea with custom JS validation
  • ๐ŸŒ Language selector tied to Joomlaโ€™s multilingual system

Creating a Shared Field Type

  1. Go to Components โ†’ JCB โ†’ Field Types.
  2. Create a new Field Type and define all its attributes.
  3. Optionally attach:
    • Field class (for styling)
    • Save/Get scripting
    • Tooltips and multilingual labels
  4. Save the Field Type. It will now be available globally.

Using Shared Field Types

  1. When creating a new field in a View or Table, select โ€œField Type.โ€
  2. Choose from the list of predefined field types.
  3. Modify the label or override specific attributes as needed (if cloning).
  4. Compile as usual โ€” the field will use the shared configuration.

๐Ÿง  Pro Tip: Use naming conventions like ft_published_toggle or ft_date_range for clarity and easy filtering.

Conclusion

Shared Field Types help enforce consistency, speed up development, and centralize logic across your JCB projects. Whether you're standardizing behavior or just saving time, they transform field creation into a smart, reusable process โ€” ideal for scaling across components or teams.