Skip to content

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