spicyweb / craft-odds-and-ends
A collection of useful tools for Craft CMS websites
Installs: 5 783
Dependents: 0
Suggesters: 0
Security: 0
Stars: 53
Watchers: 7
Forks: 5
Open Issues: 2
Type:craft-plugin
Requires
- php: ^8.2
- craftcms/cms: ^5.0.0
Requires (Dev)
- craftcms/ecs: dev-main
- craftcms/rector: dev-main
- dev-main
- 5.x-dev
- 5.0.0
- 5.0.0-beta.1
- 5.0.0-alpha.1
- 4.x-dev
- 4.3.1
- 4.3.0
- 4.2.0
- 4.1.2
- 4.1.1
- 4.1.0
- 4.0.0
- 3.x-dev
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.x-dev
- 2.2.3
- 2.2.2
- 2.2.1.1
- 2.2.1
- 2.2.1-beta
- 2.2.0
- 2.1.10.1
- 2.1.10
- 2.1.9
- 2.1.8
- 2.1.7
- 2.1.6
- 2.1.5
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.0
- dev-dependabot/composer/web-auth/webauthn-lib-4.9.0
- dev-feature/2020-rework-post-3.5
- dev-craft3.4
- dev-feature/2020-rework-pre-3.5
- dev-craft3.0
This package is auto-updated.
Last update: 2024-11-15 17:28:21 UTC
README
Odds & Ends
A collection of useful tools for Craft CMS websites.
Field types
Width
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.
Author Instructions
This lets you output markdown instead of a field, which is useful when you have a Matrix block that doesn’t have any fields.
Categories (multiple groups)
A Categories input that lets you select multiple Category groups.
Ancestors
An Entries input that only shows the ancestors of the current Entry.
Search Fields
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.
Disabled Fields
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
Widgets
Roll Your Own
A simple widget that lets you assign a template to load from your site templates folder. Go nuts.
Miscellaneous
Download File
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>
Configuration
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.