. * */ namespace Vvveb\Plugins\Seo; use Vvveb\System\Event; use Vvveb\System\Routes; if (! defined('V_VERSION')) { die('Invalid request!'); } #[\AllowDynamicProperties] class Rest { function types($types) { $types['post_seo'] = [ 'name' => 'post_seo', 'properties' => [ 'post_id' => [ 'name' => 'post_id', 'description' => '', 'type' => 'ID', ], 'language_id' => [ 'name' => 'language_id', 'description' => '', 'type' => 'ID', ], 'name' => [ 'name' => 'name', 'description' => '', 'type' => 'String', ], 'slug' => [ 'name' => 'slug', 'description' => '', 'type' => 'String', ], 'content' => [ 'name' => 'content', 'description' => '', 'type' => 'String', ], 'tag' => [ 'name' => 'tag', 'description' => '', 'type' => 'String', ], 'meta_title' => [ 'name' => 'meta_title', 'description' => '', 'type' => 'String', ], 'meta_description' => [ 'name' => 'meta_description', 'description' => '', 'type' => 'String', ], 'meta_keywords' => [ 'name' => 'meta_keywords', 'description' => '', 'type' => 'String', ], ], ]; $types['post_seo']['properties']['seo'] = [ 'name' => 'seo', 'type' => '[PostSeoType]', ]; $types['product_seo'] = [ 'name' => 'product_seo', 'properties' => [ 'product_id' => [ 'name' => 'product_id', 'description' => '', 'type' => 'ID', ], 'language_id' => [ 'name' => 'language_id', 'description' => '', 'type' => 'ID', ], 'name' => [ 'name' => 'name', 'description' => '', 'type' => 'String', ], 'slug' => [ 'name' => 'slug', 'description' => '', 'type' => 'String', ], 'content' => [ 'name' => 'content', 'description' => '', 'type' => 'String', ], 'tag' => [ 'name' => 'tag', 'description' => '', 'type' => 'String', ], 'meta_title' => [ 'name' => 'meta_title', 'description' => '', 'type' => 'String', ], 'meta_description' => [ 'name' => 'meta_description', 'description' => '', 'type' => 'String', ], 'meta_keywords' => [ 'name' => 'meta_keywords', 'description' => '', 'type' => 'String', ], ], ]; $types['post']['properties']['seo'] = [ 'name' => 'seo', 'type' => '[PostSeoType]', ]; $types['product']['properties']['seo'] = [ 'name' => 'seo', 'type' => '[ProductSeoType]', ]; return [$types]; } function models($models) { return [$models]; } function __construct() { Routes::addRoute('/rest/seo', ['module' => 'plugins/seo/index/index']); Event::on('Vvveb\Controller\Schema', 'types', __CLASS__, [$this, 'types']); Event::on('Vvveb\Controller\Schema', 'models', __CLASS__, [$this, 'models']); } }