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

ENH Allow overriding GridFieldFilterHeader placeholder #11418

Conversation

GuySartorelli
Copy link
Member

Provides a way to override the placeholder text for a GridFieldFilterHeader.

Issue

Comment on lines -333 to -344
private function getTitle(GridField $gridField, object $inst): string
{
if ($gridField->Title) {
return $gridField->Title;
}

if (ClassInfo::hasMethod($inst, 'i18n_plural_name')) {
return $inst->i18n_plural_name();
}

return ClassInfo::shortName($inst);
}
Copy link
Member Author

@GuySartorelli GuySartorelli Oct 6, 2024

Choose a reason for hiding this comment

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

Moved this method because private methods should be nearer the bottom than public methods.

Comment on lines +486 to +493
private function getTitle(object $inst): string
{
if (ClassInfo::hasMethod($inst, 'i18n_plural_name')) {
return $inst->i18n_plural_name();
}

return ClassInfo::shortName($inst);
}
Copy link
Member Author

@GuySartorelli GuySartorelli Oct 6, 2024

Choose a reason for hiding this comment

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

Note I've removed the code that relied on $gridField->Title because that was effectively dead code.
I've removed the corresponding parameter for $gridField from the method signature since this is a private method.

See #11416 (comment) for why I did that instead of changing it to use the Title() method.

@mfendeksilverstripe
Copy link
Contributor

Good stuff in here. I like 👍

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.

Looks good to me

@emteknetnz emteknetnz merged commit ebbd642 into silverstripe:5 Oct 11, 2024
15 checks passed
@emteknetnz emteknetnz deleted the pulls/5/override-filter-placeholder branch October 11, 2024 02:49
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.

3 participants