fix #8, transformer not found
Some checks failed
Unit Testing / phpunit (5.6, 6.2) (push) Waiting to run
Unit Testing / phpunit (7.0) (push) Waiting to run
Unit Testing / phpunit (7.2) (push) Waiting to run
Unit Testing / phpunit (7.3) (push) Waiting to run
Unit Testing / phpunit (7.4) (push) Waiting to run
Unit Testing / phpunit (8.0) (push) Waiting to run
Unit Testing / phpunit (8.1) (push) Waiting to run
Unit Testing / phpunit (8.2) (push) Waiting to run
Unit Testing / phpunit (latest) (push) Waiting to run
PHP_CodeSniffer / phpcs (push) Has been cancelled

This commit is contained in:
Benjamin Linus Witzerstorfer 2023-12-08 14:04:22 +01:00
parent d322e8e21d
commit 77594845a8

View file

@ -278,6 +278,11 @@ class Transformer_Factory {
$transformer_mapping = \get_option( 'activitypub_transformer_mapping', self::DEFAULT_TRANSFORMER_MAPPING );
$transformer_name = $transformer_mapping[ $post_type ];
$transformer_class = $this->get_transformers( $transformer_name );
if ( null === $transformer_class ) {
wp_die("transformer '". $transformer_name . "' not found", '', ["response" => 404]);
}
$transformer_instance = new $transformer_class();
$transformer_instance->set_wp_post( $wp_object );
return $transformer_instance->transform();