verbb / single-cat Goto Github PK
View Code? Open in Web Editor NEWField type for CraftCMS that allows the user to select a single category from a drop-down.
License: MIT License
Field type for CraftCMS that allows the user to select a single category from a drop-down.
License: MIT License
Anything in the roadmap to have this be compatible with CraftQL?
After upgrading to Craft 3.1 the field now displays this error: This field is not set to a valid category group.
Any interest in developing a custom plugin that presents categories from a category group as lightswitches?
Hi, now that the entrification of categories etc. is taking place, a single relation plugin would be nice!
I kinda love the simplicity and I think even craft should do it like single cat if there's only one value that can be chosen.
single relation plugin, or single entry only, since all will be entries..
No response
I get a Twig runtime error when trying to access an entry in the CP that's using this field. Here's the stacktrace.
Hi @elivz
I'm using this in a matrix within a supertable and if I set the single category field to required and then choose the blank option it silently fails. I get an indication that the error is on that page and the matrix block has vanished.
Arguably now thinking about it further maybe the blank option is redundant given that that is what the required flag on the field does? Can you elaborate on the purpose of it?
Hi @elivz
I've just discovered that the categories are not pulling the dropdown values from the correct site:
Within SingleCatField.php around Line 123:
$categories = Category::find()
->groupId($source['criteria']['groupId'])
Needs to be:
$categories = Category::find()
->siteId($this->targetSiteId($element))
->groupId($source['criteria']['groupId'])
Is it possible you could patch this in?
Would be cool if the order in the dropdown reflects a custom order. As of right now I don't know how they're currently being ordered.
I think one cool feature would be the option to target a parent category so that the dropdown displays all the children categories of that parent category.
This is such a useful little plugin and I would love to bring it forward into my Craft 4 projects. Are there any plans to update it?
Getting this error, and am unsure how to reproduce it. All I know is when I choose Single Cat as the field, in the CP I get this error:
craft\services\Structures::applyBranchLimitToElements(): Argument #2 ($branchLimit) must be of type int, null given, called in /srv/www/website.com/vendor/verbb/single-cat/src/fields/SingleCatField.php on line 63
Unsure how to reproduce.
4.4.9
3.0.2
No
No response
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.