* This function takes an array of entries and formats the 'trends' value for display.
* @param array|int $input Input data to format.
private function format_trends_for_display( $input ) {
// If input is a numeric value, format and return it.
if ( is_numeric( $input ) ) {
return sprintf( '%s%s%%', $input >= 0 ? '+' : '', $input );
// Loop through entries and format 'trends' values.
foreach ( $input as &$form ) {
// Leave early if 'trends' index doesn't exist.
if ( ! isset( $form['trends'] ) ) {
// Add percent sign to trends and + sign if value greater than zero.
$form['trends'] = sprintf( '%s%s%%', $form['trends'] >= 0 ? '+' : '', $form['trends'] );
* Check if trends can be displayed for the given entries.
* @param array $entries The entries data.
private function entries_has_trends( array $entries ): bool {
// Return false if entries array is empty.
if ( empty( $entries ) ) {
// Check if at least one array item has the 'trends' key.
foreach ( $entries as $entry ) {
if ( isset( $entry['trends'] ) ) {
* Primarily used in the HTML version of the email template.
private function get_icons_url(): array {
$base_url = WPFORMS_PLUGIN_URL . 'assets/images/email/';
'overview' => $base_url . 'icon-overview.png',
'upward' => $base_url . 'icon-upward.png',
'downward' => $base_url . 'icon-downward.png',
'notification_block' => $base_url . 'notification-block-icon.png',
'info_block' => $base_url . 'info-block-icon.png',