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 Update status flags generally, not just for SiteTree #909

Merged

Conversation

GuySartorelli
Copy link
Contributor

@GuySartorelli GuySartorelli commented Nov 20, 2024

silverstripe/silverstripe-framework#11460 makes the updateStatusFlags() extension hook available for all models. In combination with other PRs linked in the below issue, status flag rendering has now been standardised.

This PR updates fluent to add fluent status flags to any fluent model, not just SiteTree, and removes custom code that renders flags in places like LeftAndMain breadcrumbs, gridfield edit form breadcrumbs, and gridfield rows. Those are all handled in core now.

Please note that this PR relies on silverstripe/silverstripe-framework#11460 along with others.
Please do not merge this PR until all dependent PRs have been merged.

Looks like this in CMSMain:
Screenshot from 2024-11-20 14-56-20

Looks like this in gridfield (yes that is a gridfield holding pages, no it is not CMSMain):
image
image

Issue

*
* @param array $flags
*/
protected function updateStatusFlags(&$flags)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nothing here is specific to SiteTree anymore. This is now split up between FluentExtension and FluentVersionedExtension along with the methods called from here.

/**
* Update status flags based on whether the current record is exists in the current locale.
*/
protected function updateStatusFlags(array &$flags): void
Copy link
Contributor Author

Choose a reason for hiding this comment

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

See FluentSiteTreeExtension for where this code originated.

*
* @param array $flags
*/
protected function updateStatusFlags(array &$flags): void
Copy link
Contributor Author

Choose a reason for hiding this comment

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

See FluentSiteTreeExtension for where this code originated.

* @param DBField|null $badgeField
* @see VersionedGridFieldItemRequest::Breadcrumbs()
*/
protected function updateBadge(&$badgeField)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

That hook doesn't exist anymore - this is now handled through generalised status flag rendering in core.

* @param ArrayList $breadcrumbs
* @see CMSMain::Breadcrumbs()
*/
protected function updateBreadcrumbs(ArrayList $breadcrumbs)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is now handled through generalised status flag rendering in core.

Copy link
Contributor

@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 tried rerunning tests after merging everything else, there are CI failures

@GuySartorelli
Copy link
Contributor Author

Updated status flag tests and added a little more coverage than was already there.

Copy link
Contributor

@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.

Seems to do what it's supposed to do

@emteknetnz emteknetnz merged commit c302882 into tractorcow-farm:8 Nov 26, 2024
9 checks passed
@emteknetnz emteknetnz deleted the pulls/8/status-flags branch November 26, 2024 06:27
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