Cal. Welf. & Inst. Code § 5014
(a) To the extent otherwise permitted under state and federal law and consistent with the Mental Health Services Act, both of the following apply for purposes of Article 1 (commencing with Section 5150) and Article 4 (commencing with Section 5250) of Chapter 2 and Chapter 3 (commencing with Section 5350):