';
return $output;
}
/**
* Format a single value for the helper functions. Sub-fields should overwrite this method if necessary.
*
* @param array $field Field parameters.
* @param array $value The value.
* @param array $args Additional arguments. Rarely used. See specific fields for details.
* @param int|null $post_id Post ID. null for current post. Optional.
*
* @return string
*/
public static function format_single_value( $field, $value, $args, $post_id ) {
$output = '
';
foreach ( $value as $subvalue ) {
$output .= '
' . esc_html( $subvalue ) . '
';
}
$output .= '
';
return $output;
}
/**
* Since we're using an array of text fields, we need to check if all of them are empty.
* Otherwise, there is no way to know if the field is empty or not.
*/
public static function value( $new, $old, $post_id, $field ) {
$all_empty = empty( array_filter( (array) $new ) );
return $all_empty ? [] : $new;
}
}