Dynamic Select - Statamic Addon
The Dynamic Select addon for Statamic streamlines the configuration of data relationships using taxonomies. This means that the options displayed in the second selector dynamically adjust based on the choice made in the first selector. This enhances user experience by providing an intuitive and personalized selection process, allowing users to focus on and choose only the relevant options based on their initial selection. It's essential to emphasize that taxonomies must be interconnected in a one-to-many relationship through dependent fields utilizing a foreign key in the taxonomy that acts as the dependent one.
Key Features:
Simplifies configuration of data relationships through taxonomies. Dynamically adjusts the options in the second selector based on the choice in the first selector. Enhances user experience by providing a personalized selection process.
How to Install
Installation:
- Navigate to the Tools > Addons section in the Statamic control panel.
- Search for "Dynamic Select" and click Install. OR Run the following command from your project root:
composer require trestudioweb/dynamic-select
Using the Addon:
To make the most of the Dynamic Select addon, follow these steps: 1. Create two taxonomies that will be related in a one-to-many relationship. 2. Ensure that the dependent taxonomy has a field with a foreign key to link the data to the first taxonomy. This addon is specifically designed to assist in retrieving or populating dependent select fields within the content management control panel in Statamic. Make your data relationships seamless and enhance the user's ability to make informed and relevant selections.
How to Use
- Set Up Taxonomies:
- Create two taxonomies establishing a one-to-many relationship.
- Ensure the dependent taxonomy has a field with a foreign key linking it to the first taxonomy.
- Create Field Type:
- Within the content you intend to use, create the field type.
- Choose the "Dynamic-select" field type in the special section when configuring your content blueprints.
- Configure Resource:
- In the resource configuration section, select "taxonomy" as the resource origin.
- This enables the configuration section for the two taxonomies that will populate the two selects.
- Configuration of the First Taxonomy:
- Three configuration fields are available: "First Taxonomy": Choose the taxonomy populating the first select. Primary Key": Specify the primary key column within the first taxonomy. "Text Field": Specify the column containing visible text for the end user.
- Configuration of the Second Taxonomy:
- In this section, configure information for the second taxonomy with four fields: "Second Taxonomy": Choose the source of data for the second select (dependent one). "Foreign Key": Specify the foreign key in the second taxonomy establishing the one-to-many relationship with the first taxonomy. "Primary Key of the Second Taxonomy": Specify the primary key of the second taxonomy. "Text Field": Enter the name of the column containing text or labels for the second select. Follow these steps to seamlessly integrate and configure the Dynamic Select addon, enhancing the user's ability to make informed and relevant selections based on the dynamic relationships between the two taxonomies.