Skip to content

Commit 9325c3c

Browse files
committed
Add method to replace blade directive with content
1 parent 9c41d2e commit 9325c3c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/CookiesManager.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,4 +276,22 @@ public function renderInfo(): string
276276
'cookies' => $this->registrar,
277277
])->render();
278278
}
279+
280+
public function replaceInfoTag(string $wysiwyg): string
281+
{
282+
$cookieConsentInfo = view('cookie-consent::info', [
283+
'cookies' => $this->registrar,
284+
])->render();
285+
286+
$formattedString = preg_replace(
287+
[
288+
'/\<(\w)[^\>]+\>\@cookieconsentinfo\<\/\1\>/',
289+
'/\@cookieconsentinfo/',
290+
],
291+
$cookieConsentInfo,
292+
$wysiwyg,
293+
);
294+
295+
return $formattedString;
296+
}
279297
}

0 commit comments

Comments
 (0)