mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-12-15 07:33:36 +08:00
3847a76134
- This ensures content notifications are not translated to receiver language. - This adds actual plaintext support for content notifications (Was previously just HTML as text view). - Shares same base class across all mail notifications. - Also cleaned up existing notification classes. Future cleanup requested via #4501
37 lines
872 B
PHP
37 lines
872 B
PHP
<?php
|
|
|
|
namespace BookStack\Activity\Notifications\MessageParts;
|
|
|
|
use Illuminate\Contracts\Support\Htmlable;
|
|
use Stringable;
|
|
|
|
/**
|
|
* A bullet point list of content, where the keys of the given list array
|
|
* are bolded header elements, and the values follow.
|
|
*/
|
|
class ListMessageLine implements Htmlable, Stringable
|
|
{
|
|
public function __construct(
|
|
protected array $list
|
|
) {
|
|
}
|
|
|
|
public function toHtml(): string
|
|
{
|
|
$list = [];
|
|
foreach ($this->list as $header => $content) {
|
|
$list[] = '<strong>' . e($header) . '</strong> ' . e($content);
|
|
}
|
|
return implode("<br>\n", $list);
|
|
}
|
|
|
|
public function __toString(): string
|
|
{
|
|
$list = [];
|
|
foreach ($this->list as $header => $content) {
|
|
$list[] = $header . ' ' . $content;
|
|
}
|
|
return implode("\n", $list);
|
|
}
|
|
}
|