feat: add filter to social icons map #2212
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
All Submissions:
Changes proposed in this Pull Request:
COPIED FROM #2170. Props to @philipjohn Just did a minor change.
Introduces a new hook for filtering the social icons map used to determine which logo to show in the social links menu.
With the introduction of Mastodon and the plethora of instances that could be used, including self-hosted instances, it would good to allow plugins and/or child themes to filter the social icons map to add additional mastodon instance addresses. This filter achieves that and can be used like so:
It could also be used, for example, by Mastodon plugins such as the ActivityPub plugin to ensure the connected server is recognised. A further change to the Newspack Theme could add a compatibility layer for plugins like ActivityPub.
How to test the changes in this Pull Request:
Note that as the social icons map is a static class variable it wasn't possible to add the filter to that array directly to only focus on the Mastodon map, so instead I had to filter the whole list.
Other information: