This was a sprinkler that was installed incorrectly. When it broke, it could only be fixed by making a lateral repair. This was because the installer hard piped / glued the fitting for the sprinkler head. I always suggest using swing joints, so things like this don't happen.
Start by exposing the lateral.
Cut out the broken section, if the break is too close to the elbow for a coupling repair, you will need to remove the elbow. This example will cover the removal of the elbow. The coupling repair would be a standard lateral repair, but you would have the added advantage of having more flexibility in the lateral line when assembling the repair.
If possible, use the removed section to give you a guide for cutting your replacement lateral piping.
Start building the repair toward the elbow. Use couplings or a tee with threads for attaching a swing joint to supply a sprinkler.
When gluing the elbow, you will need to prep both sides at the same time. Bend the longest lateral back far enough to allow you to push the elbow on, then force the elbow onto the short side. Once the elbow is in its final assembled position, hold it in place long enough for the glue to set firmly.
If you are installing / replacing a sprinkler, assemble the swing joint and backfill (this is covered above, in Sprinkler Head Replacement). Test the lateral after the appropriate drying time.