-
Notifications
You must be signed in to change notification settings - Fork 85
Expand file tree
/
Copy pathclass-term.php
More file actions
38 lines (34 loc) · 891 Bytes
/
class-term.php
File metadata and controls
38 lines (34 loc) · 891 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/**
* Term Transformer Class file.
*
* @package Activitypub
*/
namespace Activitypub\Transformer;
/**
* Term Transformer Class.
*/
class Term extends Base {
/**
* Transforms the WP_Term object to an OrderedCollection.
*
* @see \Activitypub\Activity\Base_Object
*
* @return \Activitypub\Activity\Base_Object|\WP_Error The OrderedCollection or WP_Error on failure.
*/
public function to_object() {
$base_object = new \Activitypub\Activity\Base_Object();
$base_object->{'@context'} = 'https://www.w3.org/ns/activitystreams';
$base_object->set_type( 'OrderedCollection' );
$base_object->set_id( \get_term_link( $this->item ) );
return $base_object;
}
/**
* Get the OrderedCollection ID (term link).
*
* @return string The OrderedCollection ID (term link).
*/
public function to_id() {
return \get_term_link( $this->item );
}
}