app/View/Components/CardText.php: Add optional $subject parameter and if empty we take $card->subject
This commit is contained in:
parent
b5c61cb159
commit
f91216c983
1 changed files with 5 additions and 2 deletions
|
|
@ -10,14 +10,17 @@ class CardText extends Component
|
||||||
{
|
{
|
||||||
protected Card $card;
|
protected Card $card;
|
||||||
|
|
||||||
|
protected string $subject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new component instance.
|
* Create a new component instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct(Card $card)
|
public function __construct(Card $card, $subject = '')
|
||||||
{
|
{
|
||||||
$this->card = $card;
|
$this->card = $card;
|
||||||
|
$this->subject = strlen($subject) ? $subject : $card->subject;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -27,7 +30,7 @@ class CardText extends Component
|
||||||
*/
|
*/
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
$subject = preg_quote(__($this->card->subject));
|
$subject = preg_quote(__($this->subject));
|
||||||
|
|
||||||
// Replace non escaped '?' with subject and also Unescape escaped '?'
|
// Replace non escaped '?' with subject and also Unescape escaped '?'
|
||||||
$text = preg_replace(
|
$text = preg_replace(
|
||||||
|
|
|
||||||
Reference in a new issue