From f91216c983dd38625a881986108e1986dc622fde Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Sat, 15 Jan 2022 14:14:01 +0100 Subject: [PATCH] app/View/Components/CardText.php: Add optional $subject parameter and if empty we take $card->subject --- app/View/Components/CardText.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/View/Components/CardText.php b/app/View/Components/CardText.php index 4729257..7c28d52 100644 --- a/app/View/Components/CardText.php +++ b/app/View/Components/CardText.php @@ -10,14 +10,17 @@ class CardText extends Component { protected Card $card; + protected string $subject; + /** * Create a new component instance. * * @return void */ - public function __construct(Card $card) + public function __construct(Card $card, $subject = '') { $this->card = $card; + $this->subject = strlen($subject) ? $subject : $card->subject; } /** @@ -27,7 +30,7 @@ class CardText extends Component */ public function render() { - $subject = preg_quote(__($this->card->subject)); + $subject = preg_quote(__($this->subject)); // Replace non escaped '?' with subject and also Unescape escaped '?' $text = preg_replace(