Skip to content

Commit

Permalink
Merge pull request #14410 from craftcms/feature/customize-source-badg…
Browse files Browse the repository at this point in the history
…e-label

Add abillity to customize a badge’s label
  • Loading branch information
brandonkelly authored Feb 17, 2024
2 parents ca68ab7 + b1d0c28 commit b8d4104
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Slideout sidebars are now always toggleable; not just when the slideout is too narrow to show the sidebar alongside the content. ([#14418](https://github.com/craftcms/cms/pull/14418))
- Field Layout Designers now hide the component library sidebar in favor of “Add” disclosure menus, when they’re too narrow to show the sidebar alongside configured tabs. ([#14411](https://github.com/craftcms/cms/pull/14411))
- Element sources can now override the default badge count label for screen readers, via a `badgeLabel` key. ([#14410](https://github.com/craftcms/cms/pull/14410))
- Fixed a bug where it wasn’t possible to clear out users’ full names once they were set. ([#14402](https://github.com/craftcms/cms/pull/14402))
- Fixed an error that occurred when attempting to add nested elements to Addresses or Matrix fields on element types that don’t support drafts. ([#14396](https://github.com/craftcms/cms/pull/14396))
- Fixed a bug where double-digit nav item badge counts were overflowing. ([#14406](https://github.com/craftcms/cms/issues/14406))
Expand Down
1 change: 1 addition & 0 deletions src/base/ElementInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ public static function createCondition(): ElementConditionInterface;
* - **`status`** – The status color that should be shown beside the source label. Possible values include `green`,
* `orange`, `red`, `yellow`, `pink`, `purple`, `blue`, `turquoise`, `light`, `grey`, `black`, and `white`. (Optional)
* - **`badgeCount`** – The badge count that should be displayed alongside the label. (Optional)
* - **`badgeLabel`** – The badge count label that should be provided for screen readers. (Optional)
* - **`sites`** – An array of site IDs or UUIDs that the source should be shown for, on multi-site element indexes.
* (Optional; by default the source will be shown for all sites.)
* - **`criteria`** – An array of element criteria parameters that the source should use when the source is selected.
Expand Down
2 changes: 1 addition & 1 deletion src/templates/_elements/sources.twig
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
data: {
notification: true,
},
text: '{num, number} {num, plural, =1{notification} other{notifications}}'|t('app', {
text: source.badgeLabel ?? '{num, number} {num, plural, =1{notification} other{notifications}}'|t('app', {
num: source.badgeCount,
}),
}) }}
Expand Down

0 comments on commit b8d4104

Please sign in to comment.