AuthorPostUrl.php
2 days ago
CommentCount.php
2 days ago
FirstPost.php
2 days ago
FullName.php
2 days ago
HasRichEditing.php
2 days ago
LastPost.php
2 days ago
Meta.php
2 days ago
PostCount.php
2 days ago
PostCountOriginal.php
2 days ago
Property.php
2 days ago
Roles.php
2 days ago
ShowToolbar.php
2 days ago
TranslatedRoles.php
2 days ago
UserFilteredPostLink.php
2 days ago
UserLink.php
2 days ago
UserName.php
2 days ago
AuthorPostUrl.php
22 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\Formatter\User; |
| 6 | |
| 7 | use AC\Formatter; |
| 8 | use AC\Type\Value; |
| 9 | |
| 10 | class AuthorPostUrl implements Formatter |
| 11 | { |
| 12 | public function format(Value $value): Value |
| 13 | { |
| 14 | $url = get_author_posts_url($value->get_id()); |
| 15 | |
| 16 | return $url |
| 17 | ? $value->with_value(sprintf('<a href="%s">%s</a>', $url, $value->get_value())) |
| 18 | : $value; |
| 19 | } |
| 20 | |
| 21 | } |
| 22 |