*/ protected function input_properties(): array { return array( 'panel' => array( 'type' => 'string', 'enum' => Settings_Registry::writable_panel_slugs(), 'description' => __( 'Which settings panel to write.', 'acrossai-abilities-manager' ), ), 'settings' => array( 'type' => 'object', 'description' => __( 'Field id => value. Ids are the ones aioseo/get-settings-panel reports for this panel, dotted for nested fields such as postTypes.all. Any id not belonging to the panel rejects the whole write.', 'acrossai-abilities-manager' ), ), ); } /** * @since 0.0.44 * @return array */ protected function output_properties(): array { return array( 'scope' => array( 'type' => 'string' ), 'updated' => array( 'type' => 'object' ), 'unchanged' => array( 'type' => 'object' ), ); } /** * @since 0.0.44 * @return array */ protected function required_input(): array { return array( 'panel', 'settings' ); } /** * @since 0.0.44 * @return array{readonly: bool, destructive: bool, idempotent: bool} */ protected function annotations(): array { return array( 'readonly' => false, 'destructive' => false, 'idempotent' => true, ); } /** * @since 0.0.44 * @param array $input Input. * @return array|WP_Error */ protected function run( array $input ) { $settings = $input['settings'] ?? array(); if ( ! is_array( $settings ) ) { return new WP_Error( 'invalid_input', __( 'settings must be an object of field id => value.', 'acrossai-abilities-manager' ) ); } return Settings_Writer::write( self::scalar( $input['panel'] ?? '' ), $settings ); } }