Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/codemonauts/craft-unit-field
Field with Range of Values and predefined Units of Measurement for Craft CMS
https://github.com/codemonauts/craft-unit-field
Last synced: about 4 hours ago
JSON representation
Field with Range of Values and predefined Units of Measurement for Craft CMS
- Host: GitHub
- URL: https://github.com/codemonauts/craft-unit-field
- Owner: codemonauts
- License: other
- Created: 2020-07-11T10:54:28.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-05-06T14:35:48.000Z (over 2 years ago)
- Last Synced: 2024-10-20T18:10:40.464Z (28 days ago)
- Language: PHP
- Size: 77.1 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Field with Range of Values and predefined Units of Measurement for Craft CMS
![Icon](resources/unitfield.png)
This field allows you to enter two values as range and selecting a predefined unit of measurement. Perfect to store dimensions or other ranges of values for products.
## Requirements
* Craft CMS >= 4.0.0
## Installation
Open your terminal and go to your Craft project:
``` shell
cd /path/to/project
composer require codemonauts/craft-unit-field
./craft install/plugin unitfield
```## Plugin Settings
In the settings you can define all available units of measurement. You can also group units to easier select them later.
![Plugin settings](resources/plugin-settings.png)
## Field Settings
In every field you can set a default unit of measurement and a Twig template to render the table cells in the index of entries.
![Field settings](resources/field-settings.png)
## Input
The input field has two text inputs for the minimum and maximum value and a dropdown to choose the unit of measurement.
![Input](resources/input.png)
## Usage in templates
In templates you can access the minimum and maximum values as well as the unit value and the corresponding label:
```twig
{{ entry.myField.min }} to {{ entry.myField.max }} {{ entry.myField.unitLabel }}
```## Translation
All label can be translated. Use a translation file named `unitfield.php` in the language's translation directory.
With ❤ by [codemonauts](https://codemonauts.com)