| @@ -10,11 +10,11 @@ | ||
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * @since 2.04 |
| 13 | 13 | * |
| 14 | - * @var stdClass|null | |
| 14 | + * @var stdClass | |
| 15 | 15 | */ |
| 16 | - protected $field; | |
| 16 | + protected $field = null; | |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * @since 4.03 |
| 20 | 20 | * |
| @@ -55,9 +55,9 @@ | ||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | $this->entry = $entry; |
| 58 | 58 | $this->entry_id = $entry->id; |
| 59 | - $field = apply_filters( 'frm_field_value_object', $field ); | |
| 59 | + $field = apply_filters( 'frm_field_value_object', $field ); | |
| 60 | 60 | $this->field = $field; |
| 61 | 61 | $this->init_saved_value( $entry ); |
| 62 | 62 | } |
| 63 | 63 | |
| @@ -102,10 +102,9 @@ | ||
| 102 | 102 | * @return void |
| 103 | 103 | */ |
| 104 | 104 | public function prepare_displayed_value( $atts = array() ) { |
| 105 | 105 | $this->displayed_value = $this->saved_value; |
| 106 | - // This class shouldn't affect values. | |
| 107 | - unset( $atts['class'] ); | |
| 106 | + unset( $atts['class'] ); // This class shouldn't affect values. | |
| 108 | 107 | $this->generate_displayed_value_for_field_type( $atts ); |
| 109 | 108 | $this->filter_displayed_value( $atts ); |
| 110 | 109 | } |
| 111 | 110 | |
| @@ -226,8 +225,32 @@ | ||
| 226 | 225 | if ( ! is_object( $this->entry ) || empty( $this->entry->metas ) ) { |
| 227 | 226 | $this->entry = FrmEntry::getOne( $this->entry_id, true ); |
| 228 | 227 | if ( ! is_object( $this->entry ) ) { |
| 229 | 228 | return; |
| 229 | + } | |
| 230 | + } | |
| 231 | + | |
| 232 | + // TODO: maybe change from 'source' to 'run_filters' = 'email' | |
| 233 | + if ( isset( $atts['source'] ) && $atts['source'] === 'entry_formatter' ) { | |
| 234 | + // Deprecated frm_email_value hook | |
| 235 | + $meta = array( | |
| 236 | + 'item_id' => $this->entry->id, | |
| 237 | + 'field_id' => $this->field->id, | |
| 238 | + 'meta_value' => $this->saved_value, | |
| 239 | + 'field_type' => $this->field->type, | |
| 240 | + ); | |
| 241 | + | |
| 242 | + if ( has_filter( 'frm_email_value' ) ) { | |
| 243 | + _deprecated_function( 'The frm_email_value filter', '2.04', 'the frm_display_{fieldtype}_value_custom filter' ); | |
| 244 | + $this->displayed_value = apply_filters( | |
| 245 | + 'frm_email_value', | |
| 246 | + $this->displayed_value, | |
| 247 | + (object) $meta, | |
| 248 | + $this->entry, | |
| 249 | + array( | |
| 250 | + 'field' => $this->field, | |
| 251 | + ) | |
| 252 | + ); | |
| 230 | 253 | } |
| 231 | 254 | } |
| 232 | 255 | |
| 233 | 256 | // frm_display_{fieldtype}_value_custom hook |