faq page
This commit is contained in:
1 parent
50ec0eebf2
commit
1e4da2c8cc
73 files changed
+763
-43
No files matched your search
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use Modules\Core\Store\Services\StoreDetailsService;
|
||||
|
||||
/**
|
||||
* {placeholder} => StoreDetails column, usable in Stoic markdown (legal pages,
|
||||
* FAQ answers).
|
||||
*/
|
||||
class StorePlaceholders
|
||||
{
|
||||
private const PLACEHOLDERS = [
|
||||
'{store_name}' => 'name',
|
||||
'{store_address}' => 'address',
|
||||
'{store_phone}' => 'phone',
|
||||
'{store_contact_email}' => 'contact_email',
|
||||
'{store_legal_name}' => 'legal_name',
|
||||
'{store_tax_identifier}' => 'tax_identifier',
|
||||
'{store_registration_number}' => 'registration_number',
|
||||
];
|
||||
|
||||
public function __construct(
|
||||
private readonly StoreDetailsService $storeDetails,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Swapped in before the markdown is rendered, so values are escaped: the
|
||||
* rendered markdown is printed unescaped. An empty field renders as
|
||||
* nothing rather than leaving the raw placeholder on the page.
|
||||
*/
|
||||
public function fill(string $content): string
|
||||
{
|
||||
$details = $this->storeDetails->current();
|
||||
|
||||
return strtr($content, array_map(
|
||||
fn (string $column) => e((string) ($details->translate($column) ?? '')),
|
||||
self::PLACEHOLDERS,
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user