CollaborationCommentUserResource.php
25 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Kirki\App\Resources\CollaborationComment; |
| 4 | |
| 5 | use Kirki\Framework\Resource; |
| 6 | use function Kirki\Framework\user; |
| 7 | |
| 8 | /** |
| 9 | * Presentation for a WP_User in the @mention picker results. |
| 10 | */ |
| 11 | class CollaborationCommentUserResource extends Resource |
| 12 | { |
| 13 | /** |
| 14 | * Convert the user resource to an array. |
| 15 | */ |
| 16 | public function to_array() |
| 17 | { |
| 18 | return [ |
| 19 | 'user_id' => (int) $this->ID, |
| 20 | 'user_name' => $this->display_name, |
| 21 | 'user_avatar' => user($this->ID)->get_avatar(), |
| 22 | ]; |
| 23 | } |
| 24 | } |
| 25 |