diff --git a/src/Element/CiviremoteFundingApplicationHistoryStatusChange.php b/src/Element/CiviremoteFundingApplicationHistoryStatusChange.php index f307651..1475c07 100644 --- a/src/Element/CiviremoteFundingApplicationHistoryStatusChange.php +++ b/src/Element/CiviremoteFundingApplicationHistoryStatusChange.php @@ -57,7 +57,15 @@ public static function preRenderActivity(array $element): array { /** @var \Drupal\Core\Datetime\DateFormatterInterface $dateFormatter */ $dateFormatter = \Drupal::service('date.formatter'); - Assertion::string($element['#title']); + if (is_scalar($element['#title']) || + (is_object($element['#title']) && method_exists($element['#title'], '__toString')) + ) { + $element['#title'] = (string) $element['#title']; + } + else { + throw new \InvalidArgumentException('Expected string for "#title", got ' . gettype($element['#title'])); + } + Assertion::isInstanceOf($element['#activity'], ApplicationProcessActivity::class); $activity = $element['#activity']; diff --git a/src/Element/CiviremoteFundingClearingHistoryStatusChange.php b/src/Element/CiviremoteFundingClearingHistoryStatusChange.php index 9e0d1b7..3ec9ffc 100644 --- a/src/Element/CiviremoteFundingClearingHistoryStatusChange.php +++ b/src/Element/CiviremoteFundingClearingHistoryStatusChange.php @@ -39,7 +39,7 @@ public function getInfo(): array { // Array mapping status to \Drupal\civiremote_funding\Api\DTO\Option. // Instance of \Drupal\civiremote_funding\Api\DTO\Option. '#status_option' => NULL, - '#title' => $this->t('Clearing Status: @status'), + '#title' => $this->t('Clearing Status: @status')->__toString(), '#status_label' => NULL, '#source_contact_title' => $this->t('Performed by'), '#pre_render' => [ @@ -57,7 +57,15 @@ public static function preRenderActivity(array $element): array { /** @var \Drupal\Core\Datetime\DateFormatterInterface $dateFormatter */ $dateFormatter = \Drupal::service('date.formatter'); - Assertion::string($element['#title']); + if (is_scalar($element['#title']) || + (is_object($element['#title']) && method_exists($element['#title'], '__toString')) + ) { + $element['#title'] = (string) $element['#title']; + } + else { + throw new \InvalidArgumentException('Expected string for "#title", got ' . gettype($element['#title'])); + } + Assertion::isInstanceOf($element['#activity'], ApplicationProcessActivity::class); $activity = $element['#activity'];