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

NEW: Better type default. #830

Merged

Conversation

mfendeksilverstripe
Copy link
Contributor

@mfendeksilverstripe mfendeksilverstripe commented Aug 31, 2020

Better type default for BaseElement

  • better default for the Type on BaseElement
  • simplified configuration (configured by singular_name)
  • localisation is retained

Related issues

#831

@ScopeyNZ
Copy link
Contributor

Thanks for the PR @mfendeksilverstripe. You'll need to target 4 for this change as it's an enhancement.

I believe that we didn't use i18n_singular_name here on purpose, but I can't remember why... Maybe Robbie will be able to shed some light.

@mfendeksilverstripe
Copy link
Contributor Author

@ScopeyNZ Rebased on 4.

@brynwhyman
Copy link

I believe that we didn't use i18n_singular_name here on purpose, but I can't remember why... Maybe Robbie will be able to shed some light.

People might avoid this PR due to this comment. Let's see if @robbieaverill remembers ;P

Copy link
Member

@emteknetnz emteknetnz left a comment

Choose a reason for hiding this comment

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

I've made a recommended change - would this work for you?

src/Models/BaseElement.php Outdated Show resolved Hide resolved
@mfendeksilverstripe
Copy link
Contributor Author

This is ready for review @emteknetnz

@emteknetnz
Copy link
Member

Looking through previous comments + code I think the reason not to use i18n_singular_name was because if no translation yml or config defines singlular name, it will back to ClassInfo::shortName($this) which is the classname minus the namespace. Depending on the name of the class, that may be worse reading than simply "Block"

However i18n_singular_name is used a lot throughout Silverstripe, so I'm happy as is

@mfendeksilverstripe there's a PHPCS issue to fix before merging https://app.travis-ci.com/github/silverstripe/silverstripe-elemental/jobs/544323711#L1298

@mfendeksilverstripe
Copy link
Contributor Author

mfendeksilverstripe commented Jan 17, 2022

@emteknetnz Thanks for feedback, I've pushed up the linting fix.

Copy link
Member

@emteknetnz emteknetnz left a comment

Choose a reason for hiding this comment

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

Travis failure in PHP8 behat is existing

@emteknetnz emteknetnz merged commit a16873d into silverstripe:4 Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants