WIP
This commit is contained in:
parent
6c6d9076a8
commit
d9a1beae5c
2 changed files with 14 additions and 6 deletions
|
@ -93,6 +93,12 @@ class Event extends Base_Object {
|
|||
*/
|
||||
protected $status;
|
||||
|
||||
/**
|
||||
* TODO this seems to not be a default property of an Object but needed by mobilizon TODO:
|
||||
*/
|
||||
protected $actor;
|
||||
|
||||
|
||||
/**
|
||||
* @context https://joinmobilizon.org/ns#externalParticipationUrl
|
||||
* @var string
|
||||
|
|
|
@ -10,9 +10,12 @@ use Activitypub\Transformer\Attachment;
|
|||
*/
|
||||
class Factory {
|
||||
const DEFAULT_TRANSFORMER_MAPPING = array(
|
||||
'WP_Post' => array(
|
||||
'post' => 'activitypub/post',
|
||||
'page' => 'activitypub/post',
|
||||
'attachment' => 'activitypub/attachment',
|
||||
),
|
||||
'WP_Comment' => 'activitypub/comment'
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -252,7 +255,7 @@ class Factory {
|
|||
return $transformer;
|
||||
}
|
||||
|
||||
// use default transformer
|
||||
// Use the built-in transformers.
|
||||
switch ( get_class( $object ) ) {
|
||||
case 'WP_Post':
|
||||
if ( 'attachment' === $object->post_type ) {
|
||||
|
@ -283,13 +286,12 @@ class Factory {
|
|||
case 'WP_Post':
|
||||
$post_type = get_post_type( $object );
|
||||
$transformer_mapping = \get_option( 'activitypub_transformer_mapping', self::DEFAULT_TRANSFORMER_MAPPING );
|
||||
$transformer_name = $transformer_mapping[ $post_type ];
|
||||
$transformer_name = $transformer_mapping[ 'WP_Post' ][ $post_type ];
|
||||
if ( $transformer_name ) {
|
||||
$transformer_class = $this->get_transformer_class( $transformer_name );
|
||||
} else {
|
||||
return self::get_default_transformer( $object );
|
||||
}
|
||||
|
||||
if ( $transformer_class ) {
|
||||
return new $transformer_class( $object );
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue