-
-
Notifications
You must be signed in to change notification settings - Fork 536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.x] Dictionaries #10380
Merged
Merged
[5.x] Dictionaries #10380
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ready for Flat Camp ⛺
duncanmcclean
force-pushed
the
dictionaries
branch
from
July 2, 2024 10:46
c1715a7
to
0641a34
Compare
…equirement just for that.
I've made a whole bunch of tweaks. The initial description of this PR is fairly outdated now. The docs PR is the most up to date source now. statamic/docs#1405 tl;dr:
|
…edicated config was removed
the _ the selector is being found by rollup-inject (defined in vite.config.js) - it shouldnt look in <style> parts of vue files, but apparently it does.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces the concept of Dictionaries to Statamic.
The Dictionary fieldtype works in a similar way to the Select fieldtype. However, the main difference is that the options are returned from a PHP class (called a "dictionary"), instead of being defined in the field's config.
There's a few common use cases where this is helpful:
Available Dictionaries
Statamic includes a few helpful dictionaries right out of the box:
Building your own dictionary
It's really easy to build your own dictionary...
Generate a dictionary class using
php please
:If you want to generate a dictionary for an addon, use the
--addon
parameter.In your
app/Dictionaries
directory (orsrc/Dictionaries
in an addon), you'll see your newProvinces
dictionary has been generated:options
method should return a key/value array of all options.$search
variable will be provided if the user is searching options. Feel free to search the options in whatever way works for you.get
method should return a single option.