unionco / headless
UNION.co Plugin
1.1
2024-04-18 15:17 UTC
Requires
- abryrath/monolog-mysql: ^1.1.0
- craftcms/cms: >=3.4
Requires (Dev)
- vimeo/psalm: ^3.4
README
This module offers a way to attach behaviors to your elements using Craft's own $element->attachBehavior()
method. It provides base transformations for all elements and plugins mentioned, an abstraction layer for the element api and some helper methods.
Available Base Behaviors
- BaseAssetBehavior
- BaseCategoryBehavior
- BaseEntryBehavior
- BaseGlobalSetBehavior
- BaseMatrixBlockBehavior
- BaseNeoBlockBehavior1
- BaseProductBehavior2
- BaseSupertableBlockBehavior3
- BaseTagBehavior
- BaseUserBehavior
- BaseVariantBehavior2
Other Available Behaviors
Corresponding plugins must be installed for these behaviors to be attached.
- Freeform
- Navigation (verbb)
- Linkit
1 Must have Neo plugin installed 2 Must have Craft Commerce plugin installed 3 Must have Supertable plugin installed
Installation
To install this module, just follow these steps:
- cd into your project's direction
- run
`
composer require unionco\headless`
To extend this module
- Create a custom module in your craft app with the
union\\api
namespace - Behviors will live in
behaviors\\[element]\\[property]Behavior.php
;- Entries waterfall order:
- [EntryTypeHandle]Behavior.php
- [SectionHandle]Behavior.php
- BaseEntryBehavior.php
- Categories and Tags are based on their group handles
- Users and Assets only support base level bevahiors at this point
- Matrixblocks structure (strtolower on fieldHandle)
behaviors\\matrixblocks\\[fieldHandle]\\[blockTypeHandle]Behavior.php
- Example:
behaviors\\matrixblocks\\mediagallery\\ImageTypeBehavior.php
- Base:
behaviors\\matrixblocks\\BaseMatrixBlockBehavior.php
- Neo structure (strtolower on fieldHandle)
behaviors\\neo\\[fieldHandle]\\[blockTypeHandle]Behavior.php
- Example:
behaviors\\neo\\mediagallery\\ImageTypeBehavior.php
- Base:
behaviors\\neo\\BaseNeoBlockBehavior.php
- Product and Variant are both based of the product type handle
- Entries waterfall order:
Router
TODO
Traits
TODO
Helpers
TODO