Skip to content
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] Add get method to Dictionary Item #10858

Closed
wants to merge 1 commit into from

Conversation

ajnsn
Copy link
Contributor

@ajnsn ajnsn commented Sep 29, 2024

Thank you for the great Dictionary field type.
It replaces so much custom code when dealing with Enums or API calls.

Such "dictionaries" typcially do not have not only value and label . We put a lot of data inside the extra array and need to access it often and repeatedly retrieve this extra data via keys.

Can we get a little get-helper inside the Item class to access the extra data more easily?

@jasonvarga
Copy link
Member

Hey! You can already do that via array access:

$item['color'];
$item['colour'] ?? 'red';

If having a dedicated method is really important to you we can reconsider.

@jasonvarga jasonvarga closed this Sep 30, 2024
@ajnsn ajnsn deleted the dictionariy-item-get branch September 30, 2024 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants