<?php

/**
 * Shared aside IDs block.
 *
 * @var string|null $asideIdsDetailsName
 * @var bool $asideIdsOpen
 * @var bool $asideIdsAsDetails
 * @var bool $asideIdsUuidFirst
 * @var int|string|null $asideIdValue
 * @var string|null $asideUuidValue
 */

$asideIdsDetailsName = (string) ($asideIdsDetailsName ?? '');
$asideIdsOpen = !empty($asideIdsOpen);
$asideIdsAsDetails = !array_key_exists('asideIdsAsDetails', get_defined_vars()) ? true : !empty($asideIdsAsDetails);
$asideIdsUuidFirst = !empty($asideIdsUuidFirst);
$asideIdValue = $asideIdValue ?? '';
$asideUuidValue = (string) ($asideUuidValue ?? '');
$asideUuidDisplay = $asideUuidValue !== '' ? substr($asideUuidValue, 0, 10) : '-';
$asideIdDisplay = $asideIdValue !== '' ? (string) $asideIdValue : '-';

?>
<?php if ($asideIdsAsDetails): ?>
  <details <?php if ($asideIdsDetailsName !== '') { ?>name="<?php e($asideIdsDetailsName); ?>"<?php } ?> <?php if ($asideIdsOpen) { ?>open<?php } ?>>
    <summary><?php e(t('IDs')); ?></summary>
    <hr>
<?php endif; ?>
<div class="grid">
  <?php if ($asideIdsUuidFirst): ?>
    <div>
      <small><?php e(t('UUID')); ?></small>
      <p>
        <span class="badge" data-variant="neutral" data-copy="true" data-copy-value="<?php e($asideUuidValue); ?>">
          <?php e($asideUuidDisplay); ?>
        </span>
      </p>
    </div>
    <div>
      <small><?php e(t('ID')); ?></small>
      <p>
        <span class="badge" data-variant="neutral" data-copy="true" data-copy-value="<?php e((string) $asideIdValue); ?>">
          <?php e($asideIdDisplay); ?>
        </span>
      </p>
    </div>
  <?php else: ?>
    <div>
      <small><?php e(t('ID')); ?></small>
      <p>
        <span class="badge" data-variant="neutral" data-copy="true" data-copy-value="<?php e((string) $asideIdValue); ?>">
          <?php e($asideIdDisplay); ?>
        </span>
      </p>
    </div>
    <div>
      <small><?php e(t('UUID')); ?></small>
      <p>
        <span class="badge" data-variant="neutral" data-copy="true" data-copy-value="<?php e($asideUuidValue); ?>">
          <?php e($asideUuidDisplay); ?>
        </span>
      </p>
    </div>
  <?php endif; ?>
</div>
<?php if ($asideIdsAsDetails): ?>
  </details>
<?php endif; ?>
