Cal. Civ. Proc. Code § 1021.11
(b) For purposes of this section, a party is considered a prevailing party if a court does either of the following:
(c) Regardless of whether a prevailing party sought to recover attorney’s fees or costs in the underlying action, a prevailing party under this section may bring a civil action to recover attorney’s fees and costs against a person, including an entity, attorney, or law firm, that sought declaratory or injunctive relief described by subdivision (a) not later than the third anniversary of the date on which, as applicable:
(d) None of the following are a defense to an action brought under subdivision (c):