/home/vianto5/heredit.mx/wp-content/plugins/wpforms/src/Pro/Forms/Fields/Repeater
NameSizeModeActions
Builder.php170590644editdlrm
Field.php54570644editdlrm
Frontend.php199950644editdlrm
Helpers.php93600644editdlrm
Notifications.php94740644editdlrm
Process.php177320644editdlrm
Edit: /home/vianto5/heredit.mx/wp-content/plugins/wpforms/src/Pro/Forms/Fields/Repeater/Notifications.php (9474B)
get_field_html( $message, $field, $show_empty_fields, $other_fields, $form_data, $fields, $notifications ); } /** * Get the repeater field plain text markup. * * @since 1.8.9 * @since 1.8.9.3 The $notifications parameter was added. * * @deprecated 1.9.3 * * @param string|mixed $message Field message. * @param array $field Field data. * @param bool $show_empty_fields Whether to display empty fields in the email. * @param array $form_data Form data. * @param array $fields List of submitted fields. * @param EmailNotifications $notifications Notifications instance. * * @return string */ public function get_repeater_field_plain( $message, array $field, bool $show_empty_fields, array $form_data, array $fields, EmailNotifications $notifications ): string { _deprecated_function( __METHOD__, '1.9.3 of the WPForms plugin', __CLASS__ . '::get_field_plain()' ); return $this->get_field_plain( $message, $field, $show_empty_fields, $form_data, $fields, $notifications ); } /** * Get the plain message for the repeater field. * * @since 1.9.3 * * @return string */ protected function get_plain_message(): string { // phpcs:ignore Generic.Metrics.CyclomaticComplexity, Generic.Metrics.NestingLevel.MaxExceeded $blocks = RepeaterHelpers::get_blocks( $this->field, $this->form_data ); if ( empty( $blocks ) ) { return ''; } $display = $this->field['display'] ?? 'rows'; if ( $display === 'rows' && $this->is_compact() ) { $blocks = $this->prepare_compact_blocks( $blocks ); } $repeater_message = ''; foreach ( $blocks as $key => $rows ) { $block_number = $key >= 1 ? ' #' . ( $key + 1 ) : ''; $divider = $this->get_header( $this->field['label'] . $block_number ); $fields_message = ''; foreach ( $rows as $row_key => $row ) { // Add additional rows for compact display. if ( $this->is_compact() ) { $column_class = $row_key === 0 && $display === 'rows' ? 'wpforms-first-row' : ''; $column_class = $row_key === count( $rows ) - 1 && $display === 'rows' ? 'wpforms-last-row' : $column_class; $fields_message .= sprintf( '', sanitize_html_class( $display ), sanitize_html_class( $column_class ) ); } foreach ( $row as $column ) { if ( ! isset( $column['field'] ) ) { continue; } $field_id = $column['field']; if ( isset( $this->form_data['fields'][ $field_id ] ) ) { $fields_message .= $this->get_subfield_message( $this->form_data['fields'][ $column['field'] ] ); } } } if ( $fields_message ) { $repeater_message .= $divider . $fields_message; } } return $repeater_message; } /** * Check if the current template is compact. * * @since 1.9.8 * * @return bool */ private function is_compact(): bool { return $this->get_template() === 'compact'; } /** * Prepare blocks for compact display. * * @since 1.9.8 * * @param array $blocks Blocks data. * * @return array */ private function prepare_compact_blocks( array $blocks ): array { $compact_blocks = []; foreach ( $blocks as $rows ) { foreach ( $rows as $row ) { foreach ( $row as $column_key => $column ) { $compact_blocks[ $column_key ][] = $column; } } } return [ $compact_blocks ]; } /** * Get a single sub-field HTML message. * * Adds a distinguishing CSS class to the sub-field row for compact templates * so that label-hiding CSS targets only repeater rows, not fields outside. * * @since 1.10.1 * * @param array $field Field data. * * @return string */ protected function get_subfield_message( array $field ): string { $message = parent::get_subfield_message( $field ); if ( $message !== '' && $this->is_compact() ) { $message = str_replace( 'field, $this->form_data ); if ( empty( $blocks ) || $this->is_repeater_empty( $blocks ) ) { return ''; } $display = $this->field['display'] ?? 'rows'; $output = sprintf( '', sanitize_html_class( $display ) ); if ( $display === 'rows' ) { $output .= sprintf( '%1$s
', $this->get_header( $this->field['label'] ) ); } $output .= $this->get_block_message( $blocks, $display ); $output .= ''; return $output; } /** * Check if repeater is empty. * * @since 1.9.3 * * @param array $blocks Blocks data. * * @return bool */ private function is_repeater_empty( array $blocks ): bool { // phpcs:ignore Generic.Metrics.CyclomaticComplexity, Generic.Metrics.NestingLevel.MaxExceeded foreach ( $blocks as $rows ) { foreach ( $rows as $row ) { foreach ( $row as $column ) { $field_id = $column['field'] ?? null; $field_value = $this->fields[ $field_id ]['value'] ?? null; if ( $field_value !== null && ! wpforms_is_empty_string( $field_value ) ) { return false; } } } } return true; } /** * Render repeater blocks. * * @since 1.9.3 * * @param array $blocks Blocks data. * @param string $display Display type. * * @return string */ private function get_block_message( array $blocks, string $display ): string { ob_start(); ?> $rows ) : ?> = 1 ? ' #' . ( $key + 1 ) : ''; echo '' . $this->get_header( $this->field['label'] . $block_number ) . '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } ?> get_columns_message( $row ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
form_data['fields'][ $column['field'] ] ) ) : ?> get_subfield_message( $this->form_data['fields'][ $column['field'] ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>