hook to copy and truncate

By: Massimiliano Mollo | Asked: 11/17/2022
ForumsCategory: General questionshook to copy and truncate
Massimiliano Mollo asked 2 years ago

hi to all, on this on this hook,is possible copy and truncate text on new field?

Copy multiple field values#

Use the code below to save the original values of multiple fields in Hidden (or other types of) fields. This is helpful if you want to see if there have been changes to multiple fields when the entry is edited. For the field pairs, put the id of the Hidden field to the left of the arrow and the id of the original field (the one you want to copy) on the right. You can add as many additional pairs as you'd like or remove pairs, if you have fewer than three.  

-

add_filter('frm_setup_edit_fields_vars', 'frm_copy_multiple_field_values_before_edit', 20, 3);
function frm_copy_multiple_field_values_before_edit( $values, $field, $entry_id ) { $field_pairs = array( //for each pair of fields, put the id of the copy on the left and the original field on the right
979 => 336,

); if ( ! empty( $field_pairs[$field->id])){
$args = array(
'field_id' => $field_pairs[$field->id],
'entry' => $entry_id,
); $values['value'] = FrmProEntriesController::get_field_value_shortcode( $args );
} return $values;
}

1 Answers
Rob LeVineRob LeVine answered 2 years ago
Maybe I'm missing something obvious, but can't you just alter what is returned by FrmProEntriesController::get_field_value_shortcode( $args ) and then set the altered value into $values['value'] ?

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right