I'm building a plugin that creates some custom fields that can then be added to a form. One of these fields includes some additional options that I want to use when the field data is displayed.
I'm utilising classes that extend FrmFieldType as recommended in the developer docs. This class allows for a method called prepare_display_value() that is supposed to "Customize the way the value is displayed in emails and views."
I've managed to get it working for the list of form entries and for the entry view screen in the back end. For these, Formidable passes the full field array which gives me the additional options I need to format the display.
Here's an example of the data I receive (logged using print_r() ):
Array
(
[sep] => ,
[type] => cabins
[html] =>
[show_filename] => 1
[truncate] => 1
[post_id] => 0
[form_id] => 10
[field] => stdClass Object
(
[id] => 209
[field_key] => lh3lz
[name] => Rooms
[description] =>
[type] => cabins
[default_value] =>
[options] =>
[field_order] => 4
[required] => 0
[field_options] => Array
(
[size] =>
[max] =>
[label] =>
[blank] =>
[required_indicator] => *
[invalid] =>
[separate_value] => 0
[clear_on_focus] => 0
[classes] =>
[custom_html] => <div id="frm_field_[id]_container" class="frm_form_field form-field [required_class] [error_class]">
<label for="field_[key]" id="field_[key]_label" class="frm_primary_label">[field_name]
<span class="frm_required" aria-hidden="true">[required_label]</span>
</label>
[input]
[if description]<div class="frm_description" id="frm_desc_field_[key]">[description]</div>[/if description]
[if error]<div class="frm_error" role="alert" id="frm_error_field_[key]">[error]</div>[/if error]
</div>
[minnum] => 1
[maxnum] => 10
[step] => 1
[format] =>
[placeholder] =>
[cabinlabel] => Rooms
[cabinlabel_singular] => Room
[cabinlabel_plural] => Rooms
[post_field] =>
[custom_field] =>
)
[form_id] => 10
[created_at] => 2022-09-15 23:31:40
)
[keepjs] => 0
[return_array] =>
[entry_id] => 107
[embedded_field_id] => 0
)
However, when it's building the email notifications (which is done using the [default-message] shortcode) the method receives an array with empty values, and certainly none of the data I need. Here's an example of that:
Array
(
[sep] => ,
[fields] =>
[plain_text] =>
[user_info] => 0
[include_blank] =>
[default_email] =>
[array_key] => key
[direction] => ltr
[font_size] =>
[text_color] =>
[border_width] =>
[border_color] =>
[bg_color] =>
[alt_bg_color] =>
[clickable] =>
[exclude_fields] =>
[include_fields] =>
[include_extras] =>
[inline_style] => 1
[child_array] =>
[line_breaks] => 1
[array_separator] => ,
[source] => entry_formatter
[wpautop] =>
[return_array] => 1
)
I've spent a fair bit of time searching through the Formidable code for the part that takes care of [default-message] but haven't been able to find it. I just want to ensure the field if formatted correctly by my class and method.
Can anyone help?
Please login or Register to submit your answer