Castorcito components can be used in any entity that allows the addition of custom fields. When you install the Castorcito module, the Json field (json_field) module is also automatically installed, which provides a new field type called Data. This field allows the integration of components within entities, enabling the use of the “Castorcito component” widget in the “Manage form display” tab and the “Castorcito component” formatter in the “Manage display” tab.
The steps required to create a Data type field and configure both the widget and the formatter in a content type, for example, “Basic page,” are described below.
Create the “Data” field
- On the administration menu.
Click on the "Manage" then on “Structure” link and then on the “Content Types” link.
Select the desired content type, in this example we will use the “Basic page” content type, click on the “Manage fields” button in the “Operations” column.
On the “Manage fields” page, click the “Create a new field” button.
In the field type selector, choose “Data” and click “Continue.”
Define the Label and System Name. Then, select the “JSON (raw)” option, which creates a JSON-type field at the database level. Click “Continue.”
- Complete the remaining field settings and finish by clicking “Save settings.”
Widget configuration
Access the “Manage form display” tab for the content type.
Locate the newly created field and select the “Castorcito component” widget.
When you select the widget, a gear icon ⚙️ will be enabled. Click on it to configure the available components. In this example, only one component is shown, but if you have installed the Base Pack and Advanced Pack, many more components will be available. in the "Component list" and also later in the content creation or editing form. Depending on the components selected, specific configuration options will be displayed for each one. These allow you to override the component's default settings, providing flexibility to adapt its behavior based on the field and content type.
Click “Save” to save the widget settings.
Display configuration
Go to the “Manage display” tab for the content type.
Locate the field and select the “Castorcito component” format.
When selected, a gear icon ⚙️ will also appear. Click to access the formatter settings. In this section, you can override the display options defined in the component, allowing you to customize how it will be displayed in this specific field. For example in the Slideshow component from the Basepack you will find options for the slide speed, autoplay, hide the paginations, etc.
Click “Update” to save the formatter settings. And save.