isset( $raw['id'] ) ? absint( $raw['id'] ) : 0, 'name' => mb_substr( sanitize_text_field( $name ), 0, self::MAX_NAME_LENGTH, 'UTF-8' ), 'revision' => isset( $raw['revision'] ) ? absint( $raw['revision'] ) : 0, 'builtin' => ! empty( $raw['builtin'] ), ); } /** * Same as sanitize(), but never null — malformed or absent input reads * as "no blueprint" (every column at its zero/empty default). For * callers that always record an explicit attribution snapshot for * freshly-applied content (never a review-queue restage), where that * default is exactly the correct value when nothing was echoed back. * * @param mixed $raw The request's raw `blueprint` value. * @return array{id:int,name:string,revision:int,builtin:bool} */ public static function sanitizeOrEmpty( $raw ): array { return self::sanitize( $raw ) ?? array( 'id' => 0, 'name' => '', 'revision' => 0, 'builtin' => false, ); } }