A collection of useful tools for Craft CMS websites.
This lets you define the width of a block as well as left and right padding. This field simply outputs three sets of classes which can be defined when setting the field up.
This lets you output markdown instead of a field, which is useful when you have a Matrix block that doesn’t have any fields.
A Categories input that lets you select multiple Category groups.
An Entries input that only shows the ancestors of the current Entry.
Like the Tags input, but for entries and categories (without the auto-creation feature). If Craft Commerce is installed, search fields for products and variants are also available.
The same as regular fields, but disabled. Useful for situations where you want to integrate with a third party API and store that information in a field but don’t want the user to change it.
The following field types are currently supported:
- Entries
- Categories
- Lightswitch
- Number
- PlainText
- Dropdown
- Commerce Products
- Commerce Variants
A simple widget that lets you assign a template to load from your site templates folder. Go nuts.
A controller action that will download an asset file.
The id
parameter is required and must be a valid asset ID.
Usage:
<a href="{{ actionUrl('tools/tools/download-file', { id: entry.assetField.one().id }) }}">Download</a>
By default, all normal field types and widgets are enabled.
The commerce field types are only enabled if Craft Commerce is installed and enabled.
You can disable each field type and widget by adding the following to your project's config/tools.php
file:
use spicyweb\oddsandends\fields\AuthorInstructions;
use spicyweb\oddsandends\fields\DisabledProducts;
use spicyweb\oddsandends\widgets\RollYourOwn;
return [
'disableNormalFields' => [
AuthorInstructions::class,
],
'disableCommerceFields' => [
DisabledProducts::class,
],
'disableWidgets' => [
RollYourOwn::class,
],
];
Multi environment config is supported. See Craft's docs for more info.
See config/tools.php
in this repo for an example on how to disable any field and widget.