*/ protected function input_properties(): array { return array( 'scope' => array( 'type' => 'string', 'enum' => Object_Settings_Registry::scopes(), 'description' => __( 'Which kind of object.', 'acrossai-abilities-manager' ), ), 'object' => array( 'type' => 'string', 'description' => __( 'Post type, taxonomy or archive name, e.g. post, page or category.', 'acrossai-abilities-manager' ), ), 'settings' => array( 'type' => 'object', 'description' => __( 'Field id => value, as reported by aioseo/get-object-settings. Dotted for nested fields such as advanced.robotsMeta.noindex.', '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( 'scope', 'object', '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_object( self::scalar( $input['scope'] ?? '' ), self::scalar( $input['object'] ?? '' ), $settings ); } }