| @@ -38,14 +38,15 @@ | ||
| 38 | 38 | $rules = $validation['rules'] ?? array(); |
| 39 | 39 | |
| 40 | 40 | $this->prepare_rules( $rules ); |
| 41 | 41 | |
| 42 | - foreach ( $rules as $rule_attrs ) { | |
| 42 | + foreach ( $rules as $index => $rule_attrs ) { | |
| 43 | 43 | try { |
| 44 | 44 | $rule = $this->get_item( $rule_attrs['type'] ?? '' ); |
| 45 | 45 | } catch ( Repository_Exception $exception ) { |
| 46 | 46 | continue; |
| 47 | 47 | } |
| 48 | + $rule_attrs['_rule_index'] = $index; | |
| 48 | 49 | $rule->set_settings( $rule_attrs ); |
| 49 | 50 | $rule->validate_field( $parser ); |
| 50 | 51 | } |
| 51 | 52 | } |
| @@ -63,9 +64,12 @@ | ||
| 63 | 64 | } |
| 64 | 65 | |
| 65 | 66 | public function prepare_rules( array &$rules ) { |
| 66 | 67 | foreach ( $rules as &$rule ) { |
| 67 | - $rule['value'] = jet_fb_parse_dynamic( $rule['value'] ?? '' ); | |
| 68 | + // Rules live in the form's own blocks (post_content), writable only | |
| 69 | + // with `edit_post` - never taken from the request, even on the REST | |
| 70 | + // validation route, which reloads them via Block_Helper::get_blocks_by_post(). | |
| 71 | + $rule['value'] = jet_fb_parse_dynamic_trusted( $rule['value'] ?? '' ); | |
| 68 | 72 | } |
| 69 | 73 | } |
| 70 | 74 | |
| 71 | 75 | /** |