Payment gateway ID not shown if there's only one payment gateway

Created on 24 October 2023, 8 months ago
Updated 17 November 2023, 7 months ago

If there is only ONE payment gateway on admin/commerce/config/payment-gateways, the payment gateway ID is not visually displayed. Instead, the result in the HTML is <td #markup="PGID"></td>.

The Payment Gateway list builder swaps between two forms: if there's multiple payment gateways, it displays form values with DraggableListBuilder but, if there's only one payment gateway, it does not display as a form. buildRow() swaps between using $row[FIELD]['#markup'] = VALUE or $row[FIELD] = VALUE for everything but the ID:

    $row['label'] = $entity->label();
    $row['id']['#markup'] = $entity->id();
    // $this->weightKey determines whether the table will be rendered as a form.
    if (!empty($this->weightKey)) {
      $row['plugin']['#markup'] = $type;
      $row['mode']['#markup'] = $mode;
      $row['status']['#markup'] = $status;
    }
    else {
      $row['plugin'] = $type;
      $row['mode'] = $mode;
      $row['status'] = $status;
    }

To fix this, we need to move the id into the if/else like plugin, mode, and status.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Payment

Created by

🇺🇸United States Morbus Iff

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024