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
HasRichEditing.php
25 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\Formatter\User; |
| 6 | |
| 7 | use AC\Exception\ValueNotFoundException; |
| 8 | use AC\Formatter; |
| 9 | use AC\Type\Value; |
| 10 | |
| 11 | class HasRichEditing implements Formatter |
| 12 | { |
| 13 | public function format(Value $value): Value |
| 14 | { |
| 15 | $user = get_userdata($value->get_id()); |
| 16 | |
| 17 | if (! $user) { |
| 18 | throw ValueNotFoundException::from_id($value->get_id()); |
| 19 | } |
| 20 | |
| 21 | return new Value('true' === ($user->rich_editing ?? null)); |
| 22 | } |
| 23 | |
| 24 | } |
| 25 |