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

Fix adding Translatable to Panels #99

Merged
merged 2 commits into from
Nov 27, 2023
Merged

Fix adding Translatable to Panels #99

merged 2 commits into from
Nov 27, 2023

Conversation

marijoo
Copy link
Contributor

@marijoo marijoo commented Nov 24, 2023

This PR resolves #87 by only assigning panel and assignedPanel if these are not already filled.

$translatedField->panel = $this->panel;
$translatedField->assignedPanel = $this->assignedPanel;
$translatedField->attribute = 'translations_' . $originalAttribute . '_' . $locale;
$translatedField->panel ??= $this->panel;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this operator is only available starting from PHP 7.4.

Could you also up the PHP requirements for this package?

Copy link
Contributor Author

@marijoo marijoo Nov 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the style changes I accidentally commited. I reverted them and also now use the ?? instead of ??=. I know this is a little less beautiful, but I don’t think it legitimates requiring [email protected]. What do you think?

Thanks for pointing out that this operator wasn’t available in 7.3.

This keeps PHP 7.3 support, since the null coalescing assigment
operator was introduced in PHP 7.4.
@freekmurze freekmurze merged commit cd3389c into spatie:main Nov 27, 2023
@freekmurze
Copy link
Member

👍 Thanks!

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.

Adding Translatable to new Panel doesn't work
2 participants