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

API Update API to reflect changes in silverstripe/framework #1271

Open
wants to merge 1 commit into
base: 6
Choose a base branch
from

Conversation

GuySartorelli
Copy link
Member

@GuySartorelli GuySartorelli commented Nov 7, 2024

Replaces use of the overly-broadly named description configuration in favour of the new class_description config added in silverstripe/silverstripe-framework#11460 and uses i18n_classDescription instead of custom i18n code.

Also updates status flag rendering to render any flags in getStatusFlags().

Ends up looking something like this (custom flag added by overriding getStatusFlags())
Screenshot from 2024-11-20 14-56-56

Issue

@GuySartorelli GuySartorelli changed the title API Use new class_description configuration API Update API to reflect changes in silverstripe/framework Nov 20, 2024
Comment on lines -32 to -33
color: $state-draft;
background-color: $state-modified-bg;
Copy link
Member Author

Choose a reason for hiding this comment

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

Rely on silverstripe/admin styling for colours

Comment on lines -212 to +198
{this.renderStatusBadge()}
{this.renderStatusFlagBadges()}
Copy link
Member Author

Choose a reason for hiding this comment

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

We're rendering potentially multiple badges now, so I've updated the logic to handle that and to pull the status flags from BaseElement.

@@ -205,6 +205,7 @@ public function apiReadElements(HTTPRequest $request): HTTPResponse
'canPublish' => $element->canPublish(),
'canUnpublish' => $element->canUnpublish(),
'canCreate' => $element->canCreate(),
'statusFlags' => $element->getStatusFlags(),
Copy link
Member Author

Choose a reason for hiding this comment

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

Pulls through status flags for use in javascript

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.

1 participant