array( 'type' => 'integer', 'minimum' => 1, 'description' => __( 'Resolve the per-user preference for this user instead of the current one. Only consulted when users are allowed to choose.', 'acrossai-abilities-manager' ), ), ); } protected function required_input(): array { return array(); } protected function output_properties(): array { return array( 'settings' => array( 'type' => 'object' ), ); } protected function annotations(): array { return array( 'readonly' => true, 'destructive' => false, 'idempotent' => true, ); } protected function suggested_abilities(): array { return array( array( 'slug' => 'editor/get-post-editor', 'reason' => __( 'The site default is not the answer for any particular post — a remembered choice or the post\'s own content can override it.', 'acrossai-abilities-manager' ), ), array( 'slug' => 'users/get-user', 'reason' => __( 'The per-user preference is user meta under the blog-prefixed key {prefix}classic-editor-settings, values classic or block. Pass it in meta_keys.', 'acrossai-abilities-manager' ), ), array( 'slug' => 'users/update-user', 'reason' => __( 'To set one user\'s preference, write that same blog-prefixed key via meta. It only takes effect while users are allowed to choose.', 'acrossai-abilities-manager' ), ), ); } protected function run( array $input ) { $user_id = isset( $input['user_id'] ) ? (int) $input['user_id'] : 0; $settings = Editor_Settings_Repository::describe( $user_id ); return array( 'settings' => $settings, 'message' => sprintf( /* translators: 1: classic or block, 2: the deciding layer */ __( 'Editor: %1$s (decided by the %2$s setting).', 'acrossai-abilities-manager' ), $settings['editor'], $settings['decided_by'] ), ); } }