editor = $editor; } public function register(): void { add_action('admin_menu', [$this, 'menu'], 21); add_action('admin_post_' . self::ACTION_DELETE, [$this, 'handle_delete']); } public static function url(array $args = []): string { return add_query_arg(array_merge(['page' => self::SLUG], $args), admin_url('admin.php')); } public function menu(): void { add_submenu_page('zadex', __('Components', 'zadex'), __('Components', 'zadex'), 'edit_posts', self::SLUG, [$this, 'render']); } public function delete_url(int $id): string { return wp_nonce_url(add_query_arg(['action' => self::ACTION_DELETE, 'id' => $id], admin_url('admin-post.php')), self::ACTION_DELETE . '_' . $id); } public static function kind_label(string $kind): string { return $kind === 'widget' ? __('Global widget', 'zadex') : __('Component', 'zadex'); } public function render(): void { if (!current_user_can('edit_posts')) { return; } $posts = ComponentPost::all(); ?>
| post_title !== '' ? $post->post_title : __('(no title)', 'zadex')); ?> | post_modified ?? $post->post_modified_gmt)); ?> | |||