-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrandom.phtml
28 lines (24 loc) · 1.27 KB
/
random.phtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
declare(strict_types=1);
namespace SixtyEightPublishers\AmpClient\Renderer\Phtml;
use SixtyEightPublishers\AmpClient\Renderer\Options;
use SixtyEightPublishers\AmpClient\Response\ValueObject\Position;
use SixtyEightPublishers\AmpClient\Response\ValueObject\Banner;
use SixtyEightPublishers\AmpClient\Renderer\Fingerprint;
use SixtyEightPublishers\AmpClient\Renderer\AmpBannerExternalAttribute;
/** @var Position $position */
/** @var ?Banner $banner */
/** @var array<string, scalar|null> $elementAttributes */
/** @var Options $options */
?>
<div data-amp-banner="<?= Helpers::escapeHtmlAttr($position->getCode()) ?>"
data-amp-banner-external="<?= Helpers::escapeHtmlAttr(AmpBannerExternalAttribute::rendered($position)) ?>"
<?= Helpers::printAttributes(array_merge(Helpers::prefixKeys($options->toArray(), 'data-amp-option-'), $elementAttributes)) ?>>
<?php if (NULL !== $banner && 0 < count($banner->getContents())): ?>
<div class="amp-banner amp-banner--random"
data-amp-banner-fingerprint="<?= Helpers::escapeHtmlAttr(Fingerprint::create($position, $banner)) ?>"
data-amp-banner-id="<?= Helpers::escapeHtmlAttr($banner->getId()) ?>">
<?php include __DIR__ . '/contents.fragment.phtml' ?>
</div>
<?php endif ?>
</div>